Toast
Outcomes nothing else on screen shows, stacked bottom-right, at most three.
import { Toaster, toast, dismissToast, … } from "@arcadia/ui"For outcomes nothing else on screen shows: an API error, an upload result, a failed change. Never a duplicate of something already visible. Mount one <Toaster/> near the app root; at most three show, stacked bottom-right with the newest nearest the corner.
Timeouts are 5s, 8s for errors, and none while an action is offered, so nobody has to race a toast to press Retry. Hovering or focusing the stack pauses it.
Examples
rootStyle on Toaster takes where the stack sits, its width and its distance from the corner.
| Knob | Takes | Default | Sets |
|---|---|---|---|
Ref<Measure> | 360px | Width of the stack (360), capped by the viewport less the insets. | |
Ref<Space> | var(--space-4) | Distance from the viewport's bottom-right corner. |
Errors are announced assertively and everything else politely, from a labelled region. Every toast has a labelled dismiss button, and swiping right dismisses it on touch. An action in a toast must also be reachable elsewhere, because a toast can time out or be missed.
- F6
- Moves focus into the toast region
- Esc
- Dismisses the focused toast
Toaster
store- ToastStore
- Default: the store behind
toast(). limit- numberDefault3
rootStyle- RootStyle<ToasterKnobs>
- Typed StyleX override for the stack: layout and its
--toast-*knobs. dismissLabel- stringDefault"Dismiss"
- Accessible name of each dismiss button.
className- string
- A product's hook class for the stack (being retired: new code sets
rootStyle).
titlerequired- ReactNode
description- ReactNode
tone- "info" | "success" | "warning" | "error"Default"info"
action- { label: string; onClick: () => void }
- One action button ("Undo", "Retry"); a toast with an action stays until dismissed.
timeout- numberDefault5000
- Auto-dismiss after ms; 0 keeps it. 8000 for errors, 0 with an action.
id- string
- Re-using an id updates that toast in place and restarts its timer.