Toast
Stacked notifications with status icons, per-type durations, pause on hover, actions, and in-place promise updates — one engine, zero setup.
Installation#
pnpm dlx shadcn@latest add @davinciui/toastUsage#
API Reference#
| Prop | Type | Default |
|---|---|---|
typeStatus icon and tint. Loading never auto-dismisses. | "default" | "success" | "error" | "warning" | "info" | "loading" | "default" |
durationAuto-dismiss ms. Infinity stays. Actions extend to 8s for keyboard users. | number | by type (3–6s) |
actionInline action button or custom element. | { label, onClick } | ReactNode | — |
idRe-uses the matching toast instead of stacking. | string | number | — |
Toaster · positionStack anchor with matching entrance motion. | six corners + centers | "bottom-right" |
toastPromiseUpdates one toast loading → success/error. Messages accept functions. | function | — |
toast.dismissDismiss one toast, or all when id is omitted. | (id?) => void | — |
Accessibility#
Error toasts use role=alert and other types role=status; the dismiss button has an aria-label and actions are buttons. Focus is not moved or trapped, Escape is not handled, and auto-dismiss pauses on hover or focus.
Motion#
Toasts fade and slide in over 200ms, exit with a 200ms opacity and translate transition, and the loading icon spins. motion-reduce:animate-none and motion-reduce:transition-none suppress these; duration controls auto-dismiss timing.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

