Feedback
Toast
A brief, non-blocking message after an action: saved, hidden, failed.
import { Toaster } from '@jsonresume/ui'Source(opens in a new tab)
Examples
Show code
toast/tones.tsx
'use client';
import { Button, toast } from '@jsonresume/ui';
// Mount <Toaster /> once in your root layout, then call toast() anywhere.
export default function ToastTones() {
return (
<>
<Button
variant="primary"
onClick={() => toast({ title: 'Resume saved', tone: 'success' })}
>
Save
</Button>
<Button
onClick={() =>
toast({
title: 'Job hidden',
description: 'Senior Engineer at Stripe',
action: {
label: 'Undo',
altText: 'Undo hiding the job',
onClick: () => toast({ title: 'Job restored' }),
},
})
}
>
Hide job
</Button>
<Button
variant="danger"
onClick={() =>
toast({
title: 'Upload failed',
description: 'resume.pdf is larger than 5 MB.',
tone: 'danger',
})
}
>
Fail upload
</Button>
</>
);
}Usage
Do
- Confirm actions that happen out of view.
- Offer Undo instead of asking "Are you sure?".
Don’t
- Put the only copy of important information in a toast.
- Show more than one at a time for one action.
Accessibility
- Announced through a live region; errors use an assertive announcement.
- Timers pause on hover and focus; F8 moves focus to the notifications region.
Props
<Toaster>
| Prop | Type | Default | Description |
|---|---|---|---|
| closeLabel | string | Dismiss | |
| label | string | Notifications | Accessible name of the notifications region. |