Toast
Transient notification that slides in from the screen edge. Built on Radix Toast — full ARIA live-region wiring, swipe-to-dismiss, and pause-on-hover come from the primitive. Use for non-blocking feedback (saved, copied, sent); for critical errors that need acknowledgement use Dialog with severity="alert".
Import
Provider + viewport — once per app
Mount one ToastProvider + ToastViewport at the root of your app. All toasts emitted anywhere in the tree render inside the viewport.
Variants — try the preview
Click each button to slide the matching toast into the bottom-right of its preview frame. Real Toast instances mounted inside a scoped ToastProvider + ToastViewport — same wiring you'd ship in production.
Emitting a toast
Toasts in Radix are state-driven: render a <Toast /> with controlled open and toggle it from your event handlers. For app-wide toast emission, build a thin context that owns the queue.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | 'default' | 'success' | 'warning' | 'danger' | 'default' | Sets the background tint and Memphis shadow color. Mirrors the variant tokens used by Banner. |
| open | boolean | — | Controlled open state. Pair with onOpenChange. |
| onOpenChange | (open: boolean) => void | — | Fires when the toast opens or closes. |
| duration | number | 5000 | Auto-dismiss timeout in milliseconds. Pass Infinity to disable. |
| altText | string | — | Prop on ToastAction. Required by Radix when the trigger has no text — used as the accessible action name. |
Accessibility
- The viewport sets
role="region"witharia-label="Notifications". Toasts inside render with appropriaterole+aria-liveper Radix. - When using
ToastAction, supplyaltText— the accessibility name read aloud when the toast appears. Without it Radix throws. - Hovering or focusing the viewport pauses the auto-dismiss timer; F6 jumps focus into the viewport from anywhere on the page.