Toast
A brief message that does not interrupt.
import { Button, ToastProvider, useToast } from '@rajatweb/argent'
function Save() {
const toast = useToast()
return <Button onClick={() => toast({ title: 'Saved', tone: 'success' })}>Save</Button>
}
<ToastProvider>
<Save />
</ToastProvider>Props
| Prop | Type | Default | What it does |
|---|---|---|---|
children required | string | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode> | null | undefined | ||
closeLabel | string | 'Dismiss' | Name of each close button. |
label | string | 'Notifications' | Accessible name of the toast area. |
Accessibility
- Announced without moving focus.
- Each tone has its own line pattern on the web as well as a colour.
Do
- Offer Undo where you can.
Don’t
- Use it for errors people must fix.