Installation
Theme
Mode

Overlay

Toast

A brief, self-dismissing message that confirms an action or reports a result without interrupting the flow. Toasts stack in a corner, auto-expire, and can carry a single quick action like Undo.

$npx shadcn@latest add @orbit/toast

Overview

Each button spawns a real toast that slides in, counts down, and dismisses itself. Fire several to see them stack — hover the stack to expand it and pause the timers.

Click to fire a toast (bottom-right)

Variants

A leading icon and accent communicate the result at a glance. Shown inline here for reference — real toasts are fired through the toast API.

Task created
“Ship onboarding flow” was added to Orbit.
Couldn’t save changes
Check your connection and try again.
Due date is in the past
This task is now overdue.
3 tasks moved to Done
Uploading attachment…

Anatomy & options

Keep a toast to a short title, an optional second line, and at most one action. A countdown bar can show the time remaining.

Title only
Link copied to clipboard
With an action
3 tasks moved to Done
Title + description
Task created
“Ship onboarding flow” was added to Orbit.
With countdown bar
Changes saved

Position & promises

Toasts can anchor to any corner or the top/bottom center. toast.promise() shows a loading toast that resolves in place to a success or error once an async task settles — try the “Loading → done” button in each.

Top-center
Bottom-left

Props

Mount one <Toaster> per stack — wrap a subtree and fire with useToast(), or pass the exported toastManager and fire with the global toast API from anywhere.

PropTypeDefaultDescription
position"bottom-right" | "bottom-left" | "bottom-center" | "top-right" | "top-left" | "top-center""bottom-right"Corner or edge the stack anchors to, 16px from the viewport edge.
limitnumber3Max toasts shown at once; older ones queue behind the stack.
timeoutnumber4500Provider-level default auto-dismiss delay in ms.
toastManagerToastManagerExternal manager (the exported toastManager) so the imperative toast API can fire from outside React.
classNamestringExtra classes for the 340px viewport.
childrenReactNodeSubtree that can fire toasts via useToast().

toast options

Accepted by toast.add() and the shorthands toast.info/success/warning/error/loading(title, options). toast.update(id, options), toast.dismiss(id?), and toast.promise(promise, { loading, success, error }) complete the API.

PropTypeDefaultDescription
titleReactNodeShort, verb-first headline. Required.
descriptionReactNodeOptional second line below the title.
variant"info" | "success" | "warning" | "error" | "loading""info"Tone glyph + accent. Errors and warnings are announced assertively.
action{ label: string; onClick?: () => void }Single quick action (e.g. Undo). Clicking it also dismisses the toast.
durationnumber4500Auto-dismiss delay in ms. 0 persists. Loading toasts default to 0.
progressbooleanfalseShows a countdown bar along the bottom edge while the timer runs.
dismissiblebooleantrueShows the × button. Loading toasts default to false.
idstringRe-using an id upserts the toast in place and refreshes its timer.
onClose() => voidCalled when the toast closes — timer, swipe, ×, or action.

Usage

Toasts are transient — never put anything critical only in one.

Do

Confirm actions briefly

“Task created”, “Changes saved” — a quick acknowledgment the user can ignore.

Don’t

Put critical info only in a toast

It disappears in seconds. Errors that block work belong inline or in a dialog.

Do

Offer Undo for reversible actions

A single action like Undo turns a toast into a safety net for bulk changes.

Don’t

Stack more than a few

Cap the visible count and queue the rest; a wall of toasts is just noise.

Keyboard & accessibility

Toasts render in a live region: info and success announce politely (role=status), errors and warnings assertively (role=alert). F6 jumps focus into the toast landmark to reach actions and the labeled Dismiss button; hovering or focusing the stack pauses auto-dismiss, and toasts can be swiped away. prefers-reduced-motion collapses the entrance and countdown animations.

Fire a toast, then press F6 to focus the stack