Components
Toast
Transient notification overlay. Wrap your app with ToastProvider, then use useToast to trigger notifications.
Import
Setup
Wrap your app (or the relevant subtree) with ToastProvider:
Usage
Toast methods
ToastProvider Props
| Prop | Type | Default | Description |
|---|---|---|---|
position | 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center' | 'top-right' | Screen position |
defaultDuration | number | 4000 | Auto-dismiss delay in ms |
maxToasts | number | 5 | Maximum simultaneous toasts |
useToast options
| Option | Type | Default | Description |
|---|---|---|---|
title | string | — | Bold title line |
duration | number | 4000 | Auto-dismiss delay (Infinity = no dismiss) |
dismissible | boolean | true | Show manual dismiss button |
Accessibility
- Toasts render in an
aria-live="polite"region by default - Error toasts use
aria-live="assertive"for immediate announcement - Each toast has
role="status"(orrole="alert"for errors) - Auto-dismiss respects
prefers-reduced-motion(pauses animation) - Dismiss button has accessible label