Preview
Design guidance
Use a toast to confirm a brief result or offer one immediate recovery action. Keep the title short. Add a description only when it adds useful context. The action and dismiss control belong inside the toast. Keep important or blocking problems in the page or a dialog as well.
The provider manages timing, updates, promise states, and dismissal. The toaster owns one fixed viewport. It starts at the lower right, expands on hover or focus, and keeps older notifications available through View all.
Installation
Install Toast and its Button/IconButton dependencies.
Basic usage
Mount one provider and one toaster. Add notifications from any child with the manager hook.
Structures
Toast.Provider wraps Base UI timing and manager behavior. Toast.Toaster renders one Portal and Viewport for the provider's current items. It composes each item from Root, Content, Title, Description, Action, and Close. Provide an optional leading icon with data.icon; place action content in actionProps. Toast.Action preserves Base UI callback, render, ref, and class behavior. The lower-level Portal, Viewport, Positioner, and Arrow parts remain available for custom compositions.
Examples
The examples share this host. Save it beside toast.tsx as toast-provider.tsx and wrap the examples once with ToastDemoProvider.
Simple
A short result needs only a title.
Icon
Add a caller-owned icon when it helps identify the result.
Types
Use the semantic type to show success, warning, error, or information.
Undo action
The action restores the local saved state before the toast closes.
No saved draft
Persistent reminder
Set timeout to zero when the user must dismiss the message.
Stack
Add six persistent updates to inspect collapsed cards, View all, scrolling, and Clear all.
Promise
Base UI updates one toast as the local promise resolves or rejects.
Position
Move the shared viewport to any corner or edge center.
Duplicate event
Adding the same ID again updates the existing notification.
API reference
Toast re-exports the installed Base UI manager and lower-level parts. See the Base UI Toast API for inherited props and manager options.
| Prop | Type | Default | Description |
|---|---|---|---|
position | "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right" | "bottom-right" | Places the shared viewport. |
maxVisible | number | 5 | Bounds the expanded scroll area using the first visible items' measured heights and available viewport space. |
| Prop | Type | Default | Description |
|---|---|---|---|
limit | number | 3 | Limits the collapsed stack. View all raises the native limit while the full list is open. |
timeout | number | 5000 | Default time in milliseconds before automatic dismissal. Zero keeps a toast open. |
toastManager | ToastManager | Optional manager for notifications created outside React. |
| Prop | Type | Default | Description |
|---|---|---|---|
toastrequired | ToastObject | The manager item rendered by this Root. | |
swipeDirection | "up" | "down" | "left" | "right" | Direction[] | Allowed swipe directions for dismissal. | |
className | string | (state) => string | Class applied to the Root. | |
render | ReactElement | (props, state) => ReactElement | Replaces or composes the rendered element. |
The manager's add, update, close, and promise methods preserve Base UI lifecycle behavior. Passing an existing ID to add updates that toast in place.