Toast

A brief notice that something happened. It leaves on its own.

Notifications appear in the bottom corner. Trigger a few to try the stack.

Demo project active.
Fig. 1 Show each kind of toast. They stack in the corner and dismiss themselves.

When to use it

Use Toast to confirm something that already happened and needs no reply, such as โ€œSavedโ€ or โ€œInvite sent.โ€ Add an Undo action when it helps.

Anything people must read or act on belongs on the page, in an Alert.

Alert

Stays on the page.

Changes saved
Your project is up to date and ready to share.

Warnings and errors about this page.

ToastThis page

Comes and goes.

Confirmations that need no reply.

Badge

Labels a status.

PublishedTrialCurrentInternal

Published, Draft, and Beta.

Empty

Nothing here yet.

No documents yet
Write specs, meeting notes, and decisions in one place. Documents you create or that teammates share with you will show up here.

Tip: pressโŒ˜Nfrom anywhere to start a document.

First runs and empty searches.

Fig. 2 Four ways to tell people something. Pick by how long it should stay and how much it matters.

How it behaves

Mount one Toaster near your application root, then call toast.add({ title, description }) from client-side event handlers. Avoid calling the shared manager during server rendering.

Use type=success, info, warning, error, or loading for a status icon. The surface stays neutral; errors use a destructive icon. Describe the result in words as well as color.

Pass actionProps for an action, and use the returned id with toast.close(id). Use toast.update or toast.promise to update an existing notification instead of adding duplicates.

Base UI handles announcements, dismissal, hover/focus timeout pausing, swipe gestures, and stack expansion. F6 moves focus into the toast viewport. Provider options such as timeout and limit pass through Toaster.

Stack movement uses a 220ms CSS transition with the shared ease-out curve. Reduced motion uses opacity only, and focused keyboard interaction is immediate. Loading icons stop spinning with reduced motion.

All installed composition parts remain available: ToastProvider, ToastPortal, ToastViewport, Toast, ToastContent, ToastTitle, ToastDescription, ToastAction, and ToastClose, plus createToastManager and useToastManager for a separate scope. Toaster includes close-button tooltips.

Build it

Add it with the shadcn CLI:

Terminal

A complete example. Change the values to fit your product:

toast-example.tsx

The full source is yours to edit once installed:

toast.tsx