Toast
Ephemeral feedback notification. Auto-dismissing with aria-live.
Examples
All variants
Trigger default, success, error, and action toasts. Toasts auto-dismiss after 4 s.
Warning
Warning variant for caution or threshold alerts. Uses warning colour tokens.
With title
Title and description layout for richer notifications. Title inherits the variant colour, description uses secondary text.
Persistent (closable)
Toast that stays until the user explicitly dismisses or takes action. No auto-dismiss timer.
Positions
Choose where toasts appear along the bottom edge. Select a position and trigger a toast to see it.
Installation
pnpm add @rokle/components @rokle/tokensInstalls with the default Rokle brand. Generate a custom brand on rokle.app to use your own colours and personality.
Usage
import { Toast } from "@rokle/components";import { Toast } from "@rokle/components";
export function Example() {
return <Toast />;
}API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | - | Optional bold heading above the message. |
| message | string | - | Notification text. |
| variant | "default" | "success" | "error" | "warning" | "default" | Visual style. |
| duration | number | 4000 | Auto-dismiss time in ms. Set persistent: true to disable. |
| persistent | boolean | false | When true, toast stays until manually dismissed. |
| position | "bottom-right" | "bottom-center" | "bottom-left" | "bottom-right" | Screen position for the toast container. |