API and Development
toast.dismiss(id) removes one toast and toast.dismiss() removes every toast, including calls still waiting for a Toaster.
| Option | Type | Default | Notes |
|---|---|---|---|
id | string | generated | A second call with the same id updates the toast and restarts its timer |
description | LocalizedMessage | none | Secondary text, clamped to three lines like the title |
action | { label: LocalizedMessage; onClick?: () => void } | none | A Button. Pressing it dismisses the toast without onDismiss |
duration | number (ms) | 5000 | Infinity keeps the toast until dismissed. The clock pauses on pointer, focus, and a hidden document |
source | Node | first Toaster | Element the message comes from. The toast shows in that element's document |
onDismiss | () => void | none | The person closed it (close button, Escape, swipe), or toast.dismiss removed it. Not called after the timer or the action |
onAutoClose | () => void | none | The timer dismissed it |
severity | ToastSeverity | Default | Only on toast itself; the helpers fix it |
| Prop | Type | Default | Notes |
|---|---|---|---|
label | LocalizedMessage | required | Accessible name of the notifications region. Name the Alt+T shortcut here to have it announced |
closeButton | boolean | true | false hides the close button; closeLabel is then not allowed |
closeLabel | LocalizedMessage | required with a close button | Accessible name of every close button |
position | ToastPosition | BottomCenter | Inline edges are logical: TopStart is the right in RTL |
visibleToasts | number | 3 | More toasts collapse behind the newest |
expand | boolean | false | Keeps the stack fanned out |
Toaster takes no className and no style. Mount one per document that shows toasts.
ToastSeverity: Default, Info, Success, Warning, Error.ToastPosition: TopStart, TopCenter, TopEnd, BottomStart, BottomCenter, BottomEnd.sonner, a runtime dependency pinned to one version. Only this component imports it. The reasons and the known gaps are in ADR 0005, section Toast.
No extracted props
This component does not declare package-specific props in the generated API. It may still accept standard HTML and React attributes for its underlying element (for example className, id, and ARIA attributes). Props whose types come only from dependencies are omitted from this table.