Toast

Markdown

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/ui
import { Toast } from '@stackunseen/ui';
Styles: @stackunseen/ui/styles.css

Parts

Notifications that appear in a corner and go away. One provider and one viewport serve a whole notification area.

How the parts fit together

tsx
<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>
  1. ToastProvider

    Wraps the area where toasts live.

  2. Toast

    One notification, announced politely.

    Propstone

  3. ToastTitle

    A short headline.

  4. ToastDescription

    One or two lines of detail.

  5. ToastAction

    An optional button. altText says how to do it once the toast is gone.

  6. ToastClose

    Dismisses the toast.

    Propslabel

  7. ToastViewport

    Where toasts appear. F8 moves focus there.

    Propsposition container portal

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 · ToastViewport
How state and callbacks work
All 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
Open the Markdown file

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