Toast

A transient feedback layer for copy, forward, sync, and action-result messages.

Preview#

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.

Full#

No icon#

No description#

No action#

No dismiss#

Progress#

Loading action#

Icon + title#

Minimal#

Keep long-running or historical notifications in NotificationCenter; use Toast for immediate feedback that can disappear.

Stacked#

Anchored with arrow#

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

PropTypeDefaultDescription
portalContainerBase UI Toast.Portal.Props['container']Portal container for the default viewport when ToastProvider renders it.
renderViewportbooleantruePass false when composing a custom viewport.
viewportPlacementToastViewport placement"bottom-center"Placement passed to the default ToastViewport.
viewportStrategyToastViewport strategy"fixed"Positioning strategy passed to the default ToastViewport.
...propsBase UI Toast.Provider.PropsProvides toast state and renders the default viewport/list.
PropTypeDefaultDescription
info(title: string, options?) => stringImperative info toast. Returns the toast id.
success(title: string, options?) => stringImperative success toast. Returns the toast id.
warning(title: string, options?) => stringImperative warning toast. Returns the toast id.
error(title: string, options?) => stringImperative error toast. Returns the toast id.
add(options & { title, type? }) => stringAdd a toast with an explicit type. Defaults to info.
options.progressbooleanfalseShows a bottom-edge timeout progress line for auto-dismiss toasts.
dismiss(id?: string) => voidClose one toast by id, or the active toast when omitted.
PropTypeDefaultDescription
...() => { toasts, add, close, update, promise }Advanced hook for custom toast lists, seeded docs previews, and anchored composition.
PropTypeDefaultDescription
...Base UI createToastManagerAdvanced escape hatch for isolated channels, local previews, and multiple independent toast roots.
PropTypeDefaultDescription
...propsBase UI Toast.Portal.PropsPortals the viewport. Pass container when a docs preview needs local containment.
PropTypeDefaultDescription
placementToastViewport placement"bottom-center"Use none for ToastPositioner anchored toasts.
strategy"fixed" | "absolute""fixed"Use absolute inside contained previews.
...propsBase UI Toast.Viewport.PropsViewport landmark for toasts.
PropTypeDefaultDescription
...propsBase UI Toast.Positioner.PropsPositions contextual toasts against the anchor supplied through toastManager.add({ positionerProps }).
PropTypeDefaultDescription
...propsBase UI Toast.Arrow.PropsOptional arrow rendered inside an anchored toast positioned by ToastPositioner.
PropTypeDefaultDescription
durationnumber5000Progress animation duration in milliseconds.
...propsReact.HTMLAttributes<HTMLDivElement>Bottom-edge timeout progress slot. Render inside ToastContent.
PropTypeDefaultDescription
layout"stacked" | "inline""stacked"Individual toast frame layout. Keep stacked by default; use inline only inside ToastPositioner anchored toasts or isolated one-off previews.
...propsBase UI Toast.Root.PropsIndividual toast frame.
PropTypeDefaultDescription
...propsReact.HTMLAttributes<HTMLDivElement>Leading icon slot. Compose a caller-owned status or product icon.
PropTypeDefaultDescription
...propsReact.HTMLAttributes<HTMLDivElement>Vertical stack for ToastTitle and ToastDescription.
PropTypeDefaultDescription
...propsBase UI Toast.Content.PropsGrid shell for icon, title/description, and a right-aligned action row.
PropTypeDefaultDescription
...propsReact.HTMLAttributes<HTMLDivElement>Action row container. Place ToastClose before ToastAction so dismiss appears before the primary action.
PropTypeDefaultDescription
...propsBase UI Toast.Title.PropsRenders toast.title by default, or explicit children.
PropTypeDefaultDescription
...propsBase UI Toast.Description.PropsRenders toast.description by default, or explicit children.
PropTypeDefaultDescription
loadingbooleanfalseShows a loading affordance on the action when the toast is busy.
loadingLabelstring"Loading"Accessible label for the loading spinner.
...propsBase UI Toast.Action.PropsRenders the toast action. The default toast channel maps action.label to ToastAction; custom managers can still pass Base UI actionProps.
PropTypeDefaultDescription
...propsBase UI Toast.Close.PropsDismiss button. Renders a default text label unless children are provided.