Toast
Temporary notification that appears briefly and auto-dismisses. Supports success, error, warning, and info variants.
Primitive: ToastARIA: role="status" / role="alert"Keyboard: Escape dismisses
Success
Your changes have been saved.
Error
Failed to save. Please try again.
Warning
Your session expires in 5 minutes.
Info
A new version is available.
toast.rs
use stratum_leptos::*;
// Show a toast from anywhere
toast(ToastVariant::Success, "Changes saved.");
toast(ToastVariant::Error, "Failed to save.");
// Toaster container (place once in your layout)
view! {
<Toaster position=ToastPosition::BottomRight />
}Installation
stratum add toastToast Props
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | ToastVariant | Default | Style: Default, Success, Error, Warning, Info |
| duration_ms | u32 | 5000 | Auto-dismiss time (0 = persistent) |
| on_close | Option<Callback<()>> | None | Fires when dismissed |
Toaster Props
| Prop | Type | Default | Description |
|---|---|---|---|
| position | ToastPosition | BottomRight | Screen position for the toast stack |
| max_visible | usize | 5 | Maximum visible toasts at once |
Accessibility
- Default/Success/Warning/Info use
role="status"witharia-live="polite". - Error variant uses
role="alert"witharia-live="assertive". Escapedismisses the most recent toast.