Confirmation that something happened, floating and brief.
For an action that succeeded, and for an undo. Never for something the person must act on: a toast leaves, and anything that can disappear on its own cannot carry a requirement. That belongs in Alert.
aria-live="polite" for every tone but danger, so it is announced when the reader pauses instead of cutting across them for news they did not ask to hear twice. danger is assertive, as Alert's is: a failure the person needs now is the one case worth interrupting for.
This renders one toast. Stacking, timing and dismissal are the app's, because a component that owned the timer would also have to own pausing it on hover and on focus.
import { Toast } from '@redrob-labs/ui';
| Prop | Type | Notes |
|---|---|---|
tone |
Tone |
|
title |
React.ReactNode |
|
action |
React.ReactNode |
An undo, usually. Keep it to one. |
closeLabel |
string |
|
className |
string |
|
children |
React.ReactNode |
|
onClose |
() => void |