Toast
Non-blocking feedback for success, errors, pending work and undo.
Playground
Toasts confirm what just happened and offer a way back. They stack bottom-right, pause while hovered or focused, and never ask a question the user must answer.
Invoice sent
Acme Corporation will get it by email.
Props
1import { toast } from "sonner"23toast.success("Invoice sent", {4 description: "Acme Corporation will get it by email.",5 action: { label: "Undo", onClick: () => undo() },6})Draft saved
Northwind portal, just now.
DefaultrestInvoice sent
Timer paused while hovered.
Hover:hover pauses timerInvoice sent
Alt+T moves focus here.
Focus:focus-visibleUploading 3 files…
You can keep working.
Loadingaria-busyProject archived
Undo expired after 10 seconds.
Disabledaction disabledCouldn’t send the invoice
The email bounced. Check the billing address.
Errortoast.error3 files uploaded
Added to Northwind portal.
Successtoast.success
Examples
Every type, a loading toast that turns into success, toast.promise with a result you pick, a custom rich toast, and an Undo that really restores the deleted file.
- Proposal v3.pdf
- Pricing model.xlsx
- Kickoff notes.md
- Logo pack.zip
Keyboard
- Move focus to the toast region
- Alt+T
- Reach the action and close buttons
- Tab
- Dismiss the focused toast
- Esc
Semantics and ARIA
- The toast region is an
aria-live="polite"landmark labelled “Notifications alt+T”, so new toasts are announced after the current speech without stealing focus. - Errors that block progress belong inline with
role="alert"(assertive). An error toast is a summary on top of that, never the only place the error appears. - Timers pause while a toast is hovered or focused, and the window losing focus pauses them too, so there is time to reach Undo.
- Don’t put critical-only information or the only path to an action in a toast: it disappears. Undo must also be possible from the page or history.
- Action labels are verbs (Undo, Retry, Reply). Loading toasts say what is happening and that the user can keep working.