Overview Button Copy button Field Input Number field Textarea Select Combobox Multiselect Date picker Date range picker Date-time picker Checkbox Radio group Position picker Switch Slider Dropzone Device controls Avatar Badge Card Collapsible Kbd Map Matrix Proportion bar Separator Stat Table Timeline Chat Playback Pagination Charts Chart theming Profile chart Time series chart Bar chart Isopleth chart TS diagram Box plot Rose chart Calendar chart Banner Toast Loader Progress Skeleton Empty state Error state Dropdown menu Tooltip Info tooltip Dialog Sheet Resizable Confirm dialog Breadcrumbs Command palette Mobile menu Navigation list Outline Scroll rail Sidebar Tabs
Toast
A short note in the corner about something that happened out of sight. It goes away on its own, and stacks when several arrive.
Kinds
Each kind has its intent's icon, so colour is never the only cue.
toast.success('Invite sent', { description: 'ola@vestlandmarin.no' });
toast('Mission archived', {
action: { label: 'Undo', onClick: restore },
});
toast.promise(exportCsv(), {
loading: 'Exporting 1 248 measurements...',
success: 'Export ready',
error: 'Export failed',
}); Undo and background work
Set up
<!-- Once, in the root layout -->
<Toaster theme={dark ? 'dark' : 'light'} /> Rules
- For what happens out of sight: something sent, a page left, work finishing in the background. A change you can see on the page needs no toast; a save button’s success state is enough.
- Say what happened, past tense, with the thing named: "Invite sent", not "Success!".
- An error that needs fixing belongs next to what’s wrong: a field error or a banner. A toast is for errors with nothing to point at.
- Undo instead of asking first, where the action can be reversed.
- One line of title; the description for the name or number it was about.