Toast
A short-lived notification people can dismiss, with its action also available elsewhere.
- Use it for
- A brief confirmation of something that happened, with an undo or retry.
- Not for
- Errors people must act on. Try Alert.
Toast preview
Loading example…
Installation
npm install @stackunseen/uiimport { Toast } from '@stackunseen/ui';@stackunseen/ui/styles.cssParts
Notifications that appear in a corner and go away. One provider and one viewport serve a whole notification area.
How the parts fit together
<ToastProvider>
<Toast open={open} onOpenChange={setOpen} tone="success">
<ToastTitle>Saved</ToastTitle>
<ToastDescription>Your changes are on the server.</ToastDescription>
<ToastAction altText="Open History to undo">Undo</ToastAction>
<ToastClose />
</Toast>
<ToastViewport />
</ToastProvider>ToastProviderWraps the area where toasts live.
ToastOne notification, announced politely.
ToastTitleA short headline.
ToastDescriptionOne or two lines of detail.
ToastActionAn optional button.
altTextsays how to do it once the toast is gone.ToastCloseDismisses the toast.
ToastViewportWhere toasts appear. F8 moves focus there.
Usage and props
Keep each notification in your app. Show important results somewhere that lasts, and offer the action another way once the toast is gone. Use one provider and viewport per notification area.
Supported inputs
This is the public signature used by this example. Open Code to see how the values and callbacks fit together.
ToastProvider · Toast: open/onOpenChange/tone/type/duration · ToastAction: altText · ToastClose · ToastViewportAll props
Loading…
For your coding agent
Give the agent this page instead of a screenshot. The prompt wraps the page with the install and import lines and the rule that your server, not a click, completes an action.
- Contract
- ToastProvider · Toast: open/onOpenChange/tone/type/duration · ToastAction: altText · ToastClose · ToastViewport
- Keeps honest
- Keep each notification in your app. Show important results somewhere that lasts, and offer the action another way once the toast is gone. Use one provider and viewport per notification area.
- MCP
read_component "Toast"on the docs endpoint
Keyboard and customization
Keyboard
F8 moves focus into the notification area. Hover or focus pauses expiry; Escape dismisses a focused notification.
Customization
Change shared colors, spacing, corners and icons with the theme. Use the component's supported props to adapt its content and layout. Customization guide and Theme Studio