Toast

Outside the canon

From the pattern backlog (workshop "Toast Notifications"), built for the flash after a save. The backlog records the dark variant as canonical over the light status-bg one, so the panel is always stone-dark and colour is carried by a 2px status-coloured border and the icon: a run of toasts reads as one stack. A floating surface, so it is loud by the canon's Surfaces rule — the 2px line plus shadow-brutalist-sm, the same as Popover and Modal. Stacked top-right in a z-50 container (above the Beacon tier), max-w-sm, newest last. Principle P4 asks for an undo window of at least 10 seconds on an actionable toast, so a toast with an action lives 10s and a plain one 5s; the timers are the only behaviour. ToastProvider wraps the app (it is mounted in AppShell) and useToast().toast(...) raises one — in Rails the flash is server-rendered into the layout's container and the toast controller runs the same timers, so only the plumbing differs. When a toast rather than a Banner: see the UX guide "Banner or toast?" — a toast reports what the person just did, a banner what is true about the page. Reference use: /invoicing/settings/payment-types, where a drag reorder raises an actionable toast and a toggle raises a plain one.

App: Portal::ToastComponent + the `toast` Stimulus controller

Statuses

#statuses

The panel is stone-dark on every status; only the 2px border and the icon carry the colour, so a stack of them reads as one thing. Shown here in the flow of the page — in use they are fixed top-right.

Payment type order saved

Credit Card moved to position 4.

Convenience fees are still off

Turn them on to charge the configured rate.

Report queued

It will be emailed when it finishes.

With an undo

#action

P4 asks for a recovery path on every action, so a toast that reports a change offers to reverse it. Its presence is also what gives the toast the 10-second life a plain one does not get.

Payment type order saved

Credit Card moved to position 4.

Live stack

#live

The real thing: its own ToastProvider, raising toasts into the fixed top-right container. The plain ones clear after 5s and the one with an undo after 10s.

Props

NameTypeDefaultNotes
statussuccess | error | warning | infosuccessBorder and icon only; the panel is stone-dark on every status
titleReactNode—Required. One line, semibold
descriptionReactNode—One line under it, white/70
action{ label, onClick }—The undo or follow-up, as a white underlined link (mustard is "you are here", never a link colour). Its presence is what extends the life to 10s (P4)
onDismiss() => void—Renders the close button
useToast().toast(options) => number—Raises one and returns its id; the stack owns the timer
useToast().dismiss(id: number) => void—Closes one early