Playground
Variant
Interactive Toast Spawner
Click triggers to stack toasts on the bottom-right corner of the window viewport. The last one demonstrates the optional action button (e.g. Undo).
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| message | string | — | The alert notification message to show in the toast banner. |
| variant | "success" | "error" | "warning" | "info" | "success" | Applies the status background, border, text colors and custom icons. |
| duration | number | 4000 | Auto-dismiss time duration in milliseconds. Set to 0 to disable auto-dismiss. |
| onClose | () => void | — | Callback fired when closing/dismissing the toast manually or automatically. |
| action | { label: string; onClick: () => void } | — | Optional inline action button (e.g. Undo, Retry) rendered before the close button. |
Usage Guidelines
When to use
- Use for a brief, non-blocking confirmation of something that just happened (saved, sent, copied) that doesn't need active attention.
When not to use
- Don't use Toast for anything the user must act on or can't afford to miss — it disappears on its own; use Alert for anything that needs to persist.
- Don't stack more than a couple Toasts at once.