Toast

Imperative notification API (`toast.success`, `toast.error`). Differentiates `role="alert"` from `role="status"`.

Overlays & Feedback@sisyphos-ui/toastView on npmView as Markdown

Preview

tsx

Installation

Install the individual package:

$ pnpm add @sisyphos-ui/toast @sisyphos-ui/core

Or use the umbrella package that bundles everything:

$ pnpm add @sisyphos-ui/ui

Usage

Import the component styles and the component itself:

snippet.tsxtsx
import "@sisyphos-ui/toast/styles.css";
import { Toast } from "@sisyphos-ui/toast";

Title + description

Second argument accepts `{ description, duration, dismissible, … }`.

tsx

With undo action

Pass any ReactNode as `action`. Use `toast.dismiss(id)` to close from inside the action.

tsx

All positions

Pick any of the six anchor points. The `<Toaster />` itself drives layout.

tsx

API

Props table is being written. See the package README for the complete API surface.

The full API including refs, ARIA attributes, and HTML passthroughs lives in the package README.

Was this page helpful?
Edit this page on GitHub