TrademarkTrademark
Docs
Ctrl k
Search docs...
Components

Toast

Updated: October 11, 2026
View on GitHub

The Toast component displays temporary notification messages that automatically dismiss after 6 seconds, or after their duration. The countdown pauses while a toast is hovered or has focus. It's typically used through the ToastProvider context, but can also be used standalone.

Variants

Toast supports four variants: success for positive feedback, danger for errors, warning for cautionary messages, and info for informational notices.

With actions

Add interactive elements like buttons to allow users to take action on the notification.

Without icon

Hide the default variant icon by setting icon={false}.

Toaster

The Toaster component manages multiple toast notifications, handling positioning, stacking animations, and portal rendering. It's automatically included when using ToastProvider.

The Toaster:

  • Renders toasts in a fixed position at the bottom center of the screen
  • Stacks multiple toasts with scale and opacity animations
  • Uses React portals to render outside the normal DOM hierarchy
  • Limits width to 32rem for optimal readability

Accessibility

Toast components include proper ARIA attributes:

  • role="status" with aria-live="polite" for success, info and warning, so the message is announced without interrupting
  • role="alert" (assertive) for danger only
  • The countdown pauses while the toast holds focus, so there is time to reach its action
  • Keyboard-accessible close button with tooltip

API reference

Toast element

Type
Default
className
string—
variantrequired
Severity, which sets the colour and the icon.
successdangerwarninginfo
—
showIcon
Show the icon for the variant.
booleantrue
onClose
Called when it is dismissed.
() => void—
action
A control in the toast — undo, retry, view.
React.ReactNode—
children
React.ReactNode—
duration
Milliseconds before it closes, paused while hovered or focused. Infinity keeps it up until it is closed.
number6000

Toaster element

Type
Default
toasts
{ id: string; variant: 'success' | 'danger' | 'warning' | 'info'; message: ReactNode; action?: ReactNode; duration?: number }[]—
removeToast
(id: string) => void—
Edit this page on GitHub
TrademarkTrademark
Built with curiosity by Lorant One and the Design Engineers Club