Skip to content

Feedback

Toaster

Transient, announced notifications with a LUC skin on Sonner's behaviour.

Examples

Five tones

Title, optional description, optional action. The surface never changes shade; the rail and the icon do, which is what keeps a green wall out of a dense page.

Loading, promises and actions

A promise toast is the honest way to show a long task: it changes in place rather than stacking three toasts, and it keeps the same element — so the live region announces one message, not three.

A toast that waits for the reader

A toast carrying an action deserves more than four seconds. `duration: Infinity` keeps it until the reader answers it, and hovering or focusing any toast pauses its timer — so a slow reader is never cut off mid-sentence.

A stack, not a queue of surprises

Several toasts collapse into a stack with the newest in front. The viewport shows four and the rest wait behind them, so a burst of six jobs cannot cover the page.

Usage

import { Toaster, toast } from "@luc/ui/components/toast";
<Toaster />
toast.success("Saved", { description: "3 rows updated" });

`Toaster` is mounted once at the app root; the theme comes from `LucProvider`, so a toast follows an explicit theme choice rather than the operating system.

API

Read from the published TypeScript API, so a prop that is not listed here does not exist and a default that is listed is the one the compiler sees.

Exported symbols
ExportKindSignature
Toaster20 documented props({ position, className, ...props }: ToasterComponentProps) => import("@types/react").JSX.Element

Toaster props

Type: ToasterComponentProps

Values the compiler reads from the declaration.

Toaster props
PropTypeDefaultNotes
className?string | undefined—Extra classes for the toast viewport.
closeButton?inheritedboolean | undefined—
containerAriaLabel?inheritedstring | undefined—
customAriaLabel?inheritedstring | undefined—
dir?inherited"auto" | "ltr" | "rtl" | undefined—
duration?inheritednumber | undefined—
expand?inheritedboolean | undefined—
gap?inheritednumber | undefined—
hotkey?inheritedstring[] | undefined—
icons?inheritedToastIcons | undefined—
id?inheritedstring | undefined—
invert?inheritedboolean | undefined—
mobileOffset?inheritedOffset | undefined—
offset?inheritedOffset | undefined—
position?inheritedPosition | undefined—
richColors?inheritedboolean | undefined—
style?inheritedCSSProperties | undefined—
swipeDirections?inheritedSwipeDirection[] | undefined—
toastOptions?inheritedToastOptions | undefined—
visibleToasts?inheritednumber | undefined—

Guidelines

Do

  • Use a toast for something the reader just caused and does not need to answer twice.
  • Use `toast.promise` for a long task: one surface that changes state beats three stacked toasts.
  • Give an undoable action an action button in the toast rather than a confirmation dialog in front of it.

Don't

  • Do not use a toast for an error the reader has to fix in a form; that message belongs beside the field.
  • Do not stack more than a few at once — the viewport shows four and the rest queue behind them.
  • Do not put a destructive confirmation in a toast: it disappears before a careful reader answers it.

Accessibility

Sonner owns the mechanics and the live region: a toast is announced politely, `closeButton` gives every one a named dismiss, and hover or focus pauses the timer so a slow reader is not cut off. The viewport never takes focus, so a toast cannot interrupt typing, and the LUC skin keeps the semantics it inherited — tone is carried by a rail and an icon as well as by colour, and the loading icon is `data-motion-essential`, so it becomes a slow pulse under reduced motion instead of freezing.

Where it appears, and where it is styled

`position`, `offset` and `visibleToasts` belong to the single `Toaster` you mount, not to an individual toast: the viewport is one surface, and moving it per message is how two toasts end up on top of each other. The visual layer is one file — it maps Sonner's documented custom properties to LUC tokens, then styles the parts variables cannot reach, under a `.luc-toaster` prefix.

Luc UI v1.0Toasterdark theme