2.0 alpha
These docs describe 2.0. Install it with @once-ui-system/core@alpha.
On 1.8.x? Read the 1.x docs
TrademarkTrademarkDocs
Ctrl k
Search docs...
Components

Toast

Updated: June 30, 2026
View on GitHub
The Toast component displays temporary notification messages that automatically dismiss after 6 seconds. It's typically used through the ToastProvider context, but can also be used standalone. Toast supports four variants: success for positive feedback, danger for errors, warning for cautionary messages, and info for informational notices. Add interactive elements like buttons to allow users to take action on the notification. Hide the default variant icon by setting icon={false}. 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
Toast components include proper ARIA attributes:
  • role="alert" for screen reader announcements
  • aria-live="assertive" for immediate notification
  • Keyboard-accessible close button with tooltip
Prop
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
Prop
Type
Default
toasts
{ id: string; variant: 'success' | 'danger' | 'warning' | 'info'; message: ReactNode; action?: ReactNode }[]
removeToast
(id: string) => void
Edit this page on GitHub
TrademarkTrademark
Built with curiosity by Lorant One and the Design Engineers Club