Toast
A transient feedback layer for copy, forward, sync, and action-result messages.
Controls
import {
ToastAction,
ToastActions,
ToastBody,
ToastClose,
ToastContent,
ToastDescription,
ToastIcon,
ToastPortal,
ToastProvider,
ToastProgress,
ToastRoot,
ToastTitle,
ToastViewport,
} from "raft-ui";
<ToastProvider renderViewport={false}>
<ToastPortal>
<ToastViewport>
<ToastRoot toast={toast}>
<ToastContent>
<ToastIcon />
<ToastBody>
<ToastTitle />
<ToastDescription />
</ToastBody>
<ToastActions>
<ToastClose />
<ToastAction />
</ToastActions>
<ToastProgress duration={5000} />
</ToastContent>
</ToastRoot>
</ToastViewport>
</ToastPortal>
</ToastProvider>Icon, description, action, and dismiss are all optional. Omit the part you don't need instead of rendering it empty.
Keep long-running or historical notifications in NotificationCenter; use Toast for immediate feedback that can disappear.
Anchored toasts use ToastPositioner with the positionerProps supplied to toastManager.add. Keep anchored and stacked toasts in separate ToastProvider instances when both patterns appear in the same app.
API#WIP
| Prop | Type | Default | Description |
|---|---|---|---|
portalContainer | Base UI Toast.Portal.Props['container'] | — | Portal container for the default viewport when ToastProvider renders it. |
renderViewport | boolean | true | Pass false when composing a custom viewport. |
viewportPlacement | ToastViewport placement | "bottom-center" | Placement passed to the default ToastViewport. |
viewportStrategy | ToastViewport strategy | "fixed" | Positioning strategy passed to the default ToastViewport. |
...props | Base UI Toast.Provider.Props | — | Provides toast state and renders the default viewport/list. |
| Prop | Type | Default | Description |
|---|---|---|---|
info | (title: string, options?) => string | — | Imperative info toast. Returns the toast id. |
success | (title: string, options?) => string | — | Imperative success toast. Returns the toast id. |
warning | (title: string, options?) => string | — | Imperative warning toast. Returns the toast id. |
error | (title: string, options?) => string | — | Imperative error toast. Returns the toast id. |
add | (options & { title, type? }) => string | — | Add a toast with an explicit type. Defaults to info. |
options.progress | boolean | false | Shows a bottom-edge timeout progress line for auto-dismiss toasts. |
dismiss | (id?: string) => void | — | Close one toast by id, or the active toast when omitted. |
| Prop | Type | Default | Description |
|---|---|---|---|
... | () => { toasts, add, close, update, promise } | — | Advanced hook for custom toast lists, seeded docs previews, and anchored composition. |
| Prop | Type | Default | Description |
|---|---|---|---|
... | Base UI createToastManager | — | Advanced escape hatch for isolated channels, local previews, and multiple independent toast roots. |
| Prop | Type | Default | Description |
|---|---|---|---|
...props | Base UI Toast.Portal.Props | — | Portals the viewport. Pass container when a docs preview needs local containment. |
| Prop | Type | Default | Description |
|---|---|---|---|
placement | ToastViewport placement | "bottom-center" | Use none for ToastPositioner anchored toasts. |
strategy | "fixed" | "absolute" | "fixed" | Use absolute inside contained previews. |
...props | Base UI Toast.Viewport.Props | — | Viewport landmark for toasts. |
| Prop | Type | Default | Description |
|---|---|---|---|
...props | Base UI Toast.Positioner.Props | — | Positions contextual toasts against the anchor supplied through toastManager.add({ positionerProps }). |
| Prop | Type | Default | Description |
|---|---|---|---|
...props | Base UI Toast.Arrow.Props | — | Optional arrow rendered inside an anchored toast positioned by ToastPositioner. |
| Prop | Type | Default | Description |
|---|---|---|---|
duration | number | 5000 | Progress animation duration in milliseconds. |
...props | React.HTMLAttributes<HTMLDivElement> | — | Bottom-edge timeout progress slot. Render inside ToastContent. |
| Prop | Type | Default | Description |
|---|---|---|---|
layout | "stacked" | "inline" | "stacked" | Individual toast frame layout. Keep stacked by default; use inline only inside ToastPositioner anchored toasts or isolated one-off previews. |
...props | Base UI Toast.Root.Props | — | Individual toast frame. |
| Prop | Type | Default | Description |
|---|---|---|---|
...props | React.HTMLAttributes<HTMLDivElement> | — | Leading icon slot. Compose a caller-owned status or product icon. |
| Prop | Type | Default | Description |
|---|---|---|---|
...props | React.HTMLAttributes<HTMLDivElement> | — | Vertical stack for ToastTitle and ToastDescription. |
| Prop | Type | Default | Description |
|---|---|---|---|
...props | Base UI Toast.Content.Props | — | Grid shell for icon, title/description, and a right-aligned action row. |
| Prop | Type | Default | Description |
|---|---|---|---|
...props | React.HTMLAttributes<HTMLDivElement> | — | Action row container. Place ToastClose before ToastAction so dismiss appears before the primary action. |
| Prop | Type | Default | Description |
|---|---|---|---|
...props | Base UI Toast.Title.Props | — | Renders toast.title by default, or explicit children. |
| Prop | Type | Default | Description |
|---|---|---|---|
...props | Base UI Toast.Description.Props | — | Renders toast.description by default, or explicit children. |
| Prop | Type | Default | Description |
|---|---|---|---|
loading | boolean | false | Shows a loading affordance on the action when the toast is busy. |
loadingLabel | string | "Loading" | Accessible label for the loading spinner. |
...props | Base UI Toast.Action.Props | — | Renders the toast action. The default toast channel maps action.label to ToastAction; custom managers can still pass Base UI actionProps. |
| Prop | Type | Default | Description |
|---|---|---|---|
...props | Base UI Toast.Close.Props | — | Dismiss button. Renders a default text label unless children are provided. |