Toast
Toast confirms that something happened, away from where it happened. Decide whether the person needs the message after they have moved on — if not, say it inline instead and spare the interruption.
Examples
A single toast
The close button exists only when you pass onClose. A toast without one must disappear on its
own; a toast with one must still not depend on being closed for the interface to make sense.
Inside a ToastStack
ToastStack is the fixed bottom-right container, and it is what keeps several toasts from
covering each other. Press the button more than once to see them queue.
When to use
Use Toast for a brief, non-blocking confirmation of something the person just did, when they do not need to act on it.
Reach for something else when:
- The message is about content on the page — use Alert, which stays next to it.
- Something needs a decision before continuing — use Dialog. A toast can be missed entirely.
- The message carries information someone will need later — a toast that leaves takes it with it.
Accessibility
- Toast renders
role="status", a polite live region: it is announced at the next pause, not the instant it appears. Never put the only copy of important information in one. ToastStackisposition: fixedat the bottom-right of the viewport. It sits over whatever is there, so keep toasts short and few.- The close button appears only with
onClose. Its accessible name defaults to the English string "Close notification"; passcloseLabelto translate it for a localized product. tonecolors the icon only. The words must say whether something succeeded or failed.
API and code
| Name | Type | Required | Description |
|---|---|---|---|
tone | 'info' | 'success' | 'danger' | — | Icon color tone. Default `"info"`. |
icon | ReactNode | — | Optional icon displayed before the message. |
onClose | () => void | — | Called when the optional close button is activated. |
closeLabel | string | — | Accessible name for the close button. Default: `"Close notification"`. |
children | ReactNode | Required | Toast message content. |
$store.lyraToasts
| Member | Type | Required | Description |
|---|---|---|---|
items | QueuedToast[] | Required | The current queue, in the order notifications were added. |
duration | number | Required | Default auto-dismiss delay in milliseconds. Default: `4000`. |
closeLabel | string | Required | Accessible name passed to every toast close button. Default: `"Close notification"`. |
init | (): void | Required | Registers the singleton's browser-only Livewire event bridge. |
toast | (message: string, options?: LyraToastOptions): number | Required | Queues a notification and returns its store-local identifier. |
success | (message: string, options?: LyraToastOptions): number | Required | Queues a success notification, overriding a supplied tone. |
error | (message: string, options?: LyraToastOptions): number | Required | Queues a danger notification, overriding a supplied tone. |
info | (message: string, options?: LyraToastOptions): number | Required | Queues an informational notification, overriding a supplied tone. |
dismiss | (id: number): void | Required | Removes a notification and clears its pending auto-dismiss timer, if any. |
The stack positions; the toast is a plain dark card:
<div class="lyra-toast-stack">
<div class="lyra-toast" role="status">
<span class="lyra-toast__icon lyra-toast__icon--success"></span>
<span>Project archived</span>
<button class="lyra-toast__close" type="button" aria-label="Close notification">×</button>
</div>
</div><lyra:toast> Generated from lyra-ds/blade v0.10.0.
| Prop | Default | Required | Example values |
|---|---|---|---|
tone | 'info' | — | — |
<lyra:toast tone="success">Project settings saved.</lyra:toast>