Raft Design System

Components · Feedback

Toast

A dark floating notice that confirms the result of something the person just did, disappears after a few seconds, and can offer View or Undo.

StableAlso called Snackbar
import { Toast } from "@botiverse/raft-ui";

A toast is the receipt for something the person just did: a message sent, a setting saved, an agent finishing the job they just gave it. It floats above the page on the dark HUD, says one sentence, and goes away after a few seconds. It can carry one text action, such as View or Undo.

toast/compositions/toast

When to use

SituationUse
Something the person just did has a resultToast
An action that can be reversed in placeDo it; when a toast offers Undo is in Feedback
The state of the whole serverNotificationCenter
Something that happened elsewhereActivityInbox
Something to confirm or decideDialog
Something to read before actingBanner

Never put anything in a toast that would confuse people if they missed it (Choosing a component).

Anatomy

  • ToastProvider: holds the toast manager and, by default, renders the viewport. Mount it once near the root: the default manager (toast.*) takes its timing (timeout, actionTimeout) from the one provider that uses it, so two providers on the default manager would overwrite each other's. Give a second provider its own toastManager.
  • toast: the command API (toast.success, toast.error, …) for the default manager. useToast() returns the same commands for the nearest ToastProvider's manager (Toasts in another window).
  • ToastViewport: where toasts appear on screen. ToastPositioner and ToastArrow anchor a toast to an element instead.
  • ToastRoot and ToastContent: one toast and its layout.
  • ToastIcon: optional. Who did it (an avatar), or the intent's icon when there is no "who". Never a status light for the toast's intent: a status light never says what kind of notice this is (success, info, warning, error). A status light keeps its own meanings, whether an agent, a person or a computer is working or online, a task's status, and the square attention dot that marks something waiting or unread; a notice about one of those things may still show that thing's light inside it (Status).
  • ToastBody, holding ToastTitle (required) and an optional ToastDescription, both in text-callout (Typography): 14/20 on a phone, 14/22 on a desktop, like a banner. ToastIcon is one line of that text tall, so the icon stays on the title's line: a 16px icon, centered in a 20px column 12px before the title, as is an avatar (A mark that leads text).
  • ToastActions: optional, holding one ToastAction. ToastClose (Dismiss) is there for a toast that doesn't close by itself, which Raft doesn't use; the command API shows it only with dismissible: true. Text Dismiss comes before the action, as in a banner; a × (ToastClose holding anything but text, such as an icon) always ends the row, after the action, where a dialog's or a banner's × sits, so people find the close in one place on every surface (Artea, 2026-11-21, #proj-desk). ToastClose places itself by what it holds; don't reorder it.
  • ToastProgress: an optional line that shows the time left before it closes.

Leave out a part you don't need instead of rendering it empty.

Variants

The intent sets the icon in ToastIcon, the same icon a banner of that intent leads with (Banner). When the toast is about someone, show their avatar there instead.

IntentUse forIn ToastIcon
A person or agent did it"Bugen finished reviewing #25."Their avatar
successSomething finished or savedCircleCheck
warning, errorSomething went wrong. error is announced at a higher priorityTriangleAlert
infoA neutral result, such as "3 links copied."Info

With the toast command API, pass the avatar as leading. It takes the icon's place in ToastIcon, hidden from assistive technology.

toast/compositions/person

Behavior

  • A toast closes on its own: after the provider's timeout, 5 seconds by default, and after its actionTimeout, 8 seconds, when it has an action or is an error, so there is time to read and then act. The toast command API applies actionTimeout; with a manager of your own, pass timeout: 8000 to such a toast. Hovering, focusing or touching it pauses the timer.
  • People can swipe a toast away or press Esc while it has focus (F6 moves focus to the toasts). There is no Dismiss: every toast closes by itself, and a second text action beside Undo would read as a second choice.
  • Pressing the toast's action closes the toast, and focus must not go with it: pressed from the keyboard (F6, then Enter), focus would be left on nothing. Move it to what the action brought back: Undo after a deletion focuses the item made again, at the place it is drawn. Where the item isn't drawn yet, focus waits on the region that will hold it and moves to the item once it appears; where nothing on screen draws it, focus stays on that region. Move it the same way when the action is pressed with a pointer, since the toast's button took focus and goes with it; the ring shows only after keyboard input, so a pointer press shows none. Never leave focus on the body or on the toast's old place, and once the person has moved focus themselves, leave it where they put it (Kirby, 2026-11-06, #proj-workspace:#200). The region shows a focus ring after keyboard input, inside its edge as an item's is (States); on a region whose children have backgrounds, draw it as a 2px outline offset inward (keyboard:focus-visible:outline-2 keyboard:focus-visible:outline-solid keyboard:focus-visible:-outline-offset-2), since the children would cover an inset shadow. Name outline-solid: a region that sets outline-none at rest has its outline style at none, and outline-2 alone keeps it so, drawing nothing (slock #13342).
  • One toast shows at a time (limit, 1 by default). A new toast replaces the one on screen at once, and the replaced one is closed, not queued: it doesn't come back when the new one goes.
  • An anchored toast opens next to the control that caused it (ToastPositioner), keeps clear of host frame insets, and hides while its anchor is out of view.

Where it appears

Toasts appear at the bottom center (viewportPlacement="bottom-center"; stdrc, 2026-10-23), just above whatever holds the bottom of the page: the composer on a conversation page, on a desktop as on a phone; the tab bar on a phone's top-level page; the on-screen keyboard while it is up. Where nothing holds the bottom (a desktop page with no composer), it is the bottom of the window. At the bottom of the window, a toast covered the lower half of the composer and its tools on a desktop while the person was typing (Scout, 2026-11-12, #triage:abdb39d9); one rule for every width also keeps it and the new-version banner in one place.

What counts as the bottom of the page is what sits against it and can be seen (Scout, 2026-11-12, #triage:abdb39d9):

  • Only a bar that holds the page's bottom edge counts: the composer of a conversation, a phone's tab bar. A field floating in the middle of the page (in a dialog, in a comment bubble) doesn't lift the toast, which would float into the middle of the window.
  • With the conversation beside a thread or another column, the taller of their bottom bars counts, so the toast clears both.
  • What is covered doesn't count. While a dialog or an Artifact's cover lies over the conversation, its composer behind them is not the bottom of the page, and the toast sits at the bottom of the window; when they close, it goes back above the composer.

Only the app knows where that is, so it sets --toast-viewport-bottom to the distance from the bottom of the window to that thing's top edge, on :root or with viewportClassName, and updates it as the composer grows or the keyboard opens. The toast's bottom edge sits 16px above it, and never lower than 16px above the system's home indicator (env(safe-area-inset-bottom)), so on a phone it stays clear of it even when the variable is unset.

The banner that says a new version is out holds the same place, above the composer or the tab bar: where there is no top bar (a phone, the web under 768px), and on a desktop once a day has passed without the update (The web top bar). It stays until the person chooses Dismiss or Update; toasts stack above it, so it never covers one and one never covers it (Feedback).

While a toast shows, it doesn't move down with the page (asked by artin, 2026-11-07). When the page changes under it (another page's bar is lower, or a page still loading has nothing at its bottom yet), the app keeps the tallest page edge (composer, tab bar) it has seen since the toast appeared, until the last toast is gone, and moves up when something taller appears, so it never covers the composer. The keyboard isn't part of that. While it is up, the toast follows the live edge, since the composer rides on the keyboard, and the app holds nothing it measures in that time. When the keyboard closes, the toast comes back to the held height. The Raft app does the same (RaftToastHost).

css
:root {
  --toast-viewport-bottom: 72px; /* the top edge of the composer */
}
toast/compositions/above-composer

A surface whose bottom is taken by something a toast must not cover can pass viewportPlacement="top-center" instead; the app then sets --toast-viewport-top to where its header ends, and the toast sits 16px under it, never higher than 16px under the status bar (env(safe-area-inset-top)).

A toast swipes away the way it came: down or right from the bottom, up from the top. ToastRoot takes the direction from its ToastViewport; pass swipeDirection to change it.

While a modal dialog, sheet or lightbox is open, show only the toasts it causes and that leave it open, without an action. Toasts draw above dialogs, lightboxes and their scrims (Layer order).

Toasts in another window

A part of the app drawn in a second window (an Electron window opened with window.open, under PortalContainerProvider) shows the toasts raised there in that window. It mounts a second ToastProvider inside its subtree, with a manager of its own, and raises them with useToast():

tsx
function SecondWindow({ container }: { container: HTMLElement }) {
  const [manager] = useState(() => createToastManager());
  return (
    <PortalContainerProvider container={container}>
      <ToastProvider toastManager={manager}>
        <SecondWindowContent />
      </ToastProvider>
    </PortalContainerProvider>
  );
}

function SaveButton() {
  const toast = useToast();
  return <Button onClick={() => toast.success("Saved")}>Save</Button>;
}
  • The provider's viewport renders in the window: its portalContainer falls back to the PortalContainerProvider's container.
  • useToast() gives the command API (success, error, action, actionTimeout and the rest, as toast.*) bound to the nearest provider's manager: inside the subtree that is the window's provider. useToastManager() reaches the same provider with Base UI's raw options.
  • toast.* stays bound to the default manager and so to the main window's provider. A call made outside any component (a store, a request's callback) can't know which window it is for: pass it the window's commands, or call toast.* for the main window.
  • Give the second provider its own toastManager: two providers on the default manager both show every toast.* toast, one in each window.

The toast follows the provider it is raised through, not the document the press came from. A toast is often raised after an await, from a store or a request's callback, where the press and its document are gone, and focus may have moved to the other window by then; the provider the code runs under is known wherever it runs.

Content

  • Write one sentence: who, what they did, and the result. Put anything more in ToastDescription, in foreground-on-hud-muted. It is not one of the explanation slots that take only a HelperText: it takes any content. On an error, the caller writes the recovery there ("Check your connection, then try again").
  • Label the action View or Undo, or another verb in sentence case.
  • Set IDs, counts and times in Space Mono (Typography).

Accessibility

Toast wraps Base UI's Toast, which announces each toast in a live region and keeps it open while it has focus.

  • Make ToastTitle carry the whole meaning. The icon in ToastIcon is hidden from assistive technology, and so is ToastProgress.
  • Hide an avatar in ToastIcon with aria-hidden; the name is already in the text. The command API's leading does this for you.
  • Pass loadingLabel to a ToastAction that shows a loading state, so its spinner says what it waits for.

Rules

  • Show at most one toast at a time; a new one replaces it.
  • Use layer-hud for every toast, with foreground-on-hud text. Don't tint a toast with an intent color, and never use yellow: notices are neutral (Color).
  • Make the action a bold text action that underlines on hover (ToastAction), never a button. Never put a colored button in a toast.
  • Give a toast at most one action besides closing it.
  • Make View, or any action that opens something, a shortcut only: what it opens must also be reachable where it lives, because the toast goes away by itself. Undo is different: it is the way back for something that has just left its place, which is why the toast carries it (Feedback).

API

ToastAction

PropTypeDefault
loadingbooleanfalse
loadingLabelstring"Loading"
nativeButtonWhether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`).booleantrue
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

ToastActions

Takes the attributes of its element.

ToastArrow

PropTypeDefault
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

ToastBody

Takes the attributes of its element.

ToastClose

PropTypeDefault
nativeButtonWhether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`).booleantrue
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

ToastContent, ToastDescription

The content layout (self-start, title-only sizing, body centering) needs to know which parts actually rendered. That used to be an ancestor has-selector styling descendants — a whole-page recalculation trap in Chromium (#386). It measures the rendered DOM after layout instead, so wrapped parts and parts that render nothing behave exactly like the old selectors did.
PropTypeDefault
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

ToastIcon

Takes the attributes of its element.

ToastPortal

PropTypeDefault
containerA parent element to render the portal element into.HTMLElement | ShadowRoot | RefObject<HTMLElement | ShadowRoot | null>
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

ToastPositioner

PropTypeDefault
alignHow to align the popup relative to the specified side.Align'center'
alignOffsetAdditional offset along the alignment axis in pixels. Also accepts a function that returns the offset to read the dimensions of the anchor and positioner elements, along with its side and alignment.number | OffsetFunction0
anchorAn element to position the toast against.Element
arrowPaddingMinimum distance to maintain between the arrow and the edges of the popup.number5
collisionAvoidanceDetermines how to handle collisions when positioning the popup.CollisionAvoidance
collisionBoundaryAn element or a rectangle that delimits the area that the popup is confined to.Boundary'clipping-ancestors'
collisionPaddingAdditional space to maintain from the edge of the collision boundary.Padding5
disableAnchorTrackingWhether to disable the popup from tracking any layout shift of its positioning anchor.booleanfalse
positionMethodDetermines which CSS `position` property to use."fixed" | "absolute""fixed"
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)
sideWhich side of the anchor element to align the toast against. May automatically change to avoid collisions.Side'top'
sideOffsetDistance between the anchor and the popup in pixels. Also accepts a function that returns the distance to read the dimensions of the anchor and positioner elements, along with its side and alignment.number | OffsetFunction0
stickyWhether to maintain the popup in the viewport after the anchor element was scrolled out of view.booleanfalse
toast (required)The toast object associated with the positioner.ToastObject<any>

Also takes the attributes of its element.

ToastProgress

PropTypeDefault
durationnumberDEFAULT_TOAST_TIMEOUT_MS

Also takes the attributes of its element.

ToastProvider

PropTypeDefault
actionTimeoutHow long a toast from the `toast` command API stays when it has an action or is an `error`, in ms. Defaults to 8000, or to `timeout` when that is longer, and to 0 when `timeout` is 0.number
portalContainerWhere the viewport renders: the nearest `PortalContainerProvider`'s container by default, else the body.HTMLElement | ShadowRoot | RefObject<HTMLElement | ShadowRoot | null>
renderViewportbooleantrue
viewportClassNamestring
viewportPlacement"none" | "bottom-center" | "bottom-right" | "top-center" | "top-right""bottom-center"
viewportStrategy"fixed" | "absolute""fixed"
childrenReactNode
limitThe maximum number of toasts that can be displayed at once. When the limit is exceeded, the oldest toasts are marked as `limited` (via the `data-limited` attribute) rather than removed, so they can be hidden or animated out.number1
timeoutThe default amount of time (in ms) before a toast is auto dismissed. A value of `0` will prevent the toast from being dismissed automatically.numberDEFAULT_TOAST_TIMEOUT_MS
toastManagerA global manager for toasts to use outside of a React component.ToastManager<any>defaultToastManager

ToastRoot

A toast pushed past the provider's `limit` by a newer one is closed, not held back: toasts replace each other and never queue, so an older toast can't come back when the newer one goes. Its swipe direction follows the viewport's edge unless `swipeDirection` is passed.
PropTypeDefault
layout"inline" | "stacked""stacked"
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)
swipeDirectionDirection(s) in which the toast can be swiped to dismiss."up" | "down" | "left" | "right" | ("up" | "down" | "left" | "right")[]['down', 'right']
toast (required)The toast to render.ToastRootToastObject<any>

Also takes the attributes of its element.

ToastTitle

PropTypeDefault
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

ToastViewport

PropTypeDefault
placement"none" | "bottom-center" | "bottom-right" | "top-center" | "top-right""bottom-center"
strategy"fixed" | "absolute""fixed"
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

Changes

  • 0.103.4 · FixedFrame insets (Popover, DropdownMenu, ContextMenu, Select, Combobox, ComboboxSelect, Tooltip, PreviewCard, CoachMark, NotificationCenter, MobileNavServerPopover, ToastPositioner, ComposerSuggestionList): --raft-frame-inset-start and --raft-frame-inset-end are the corners of the window's top band (--raft-frame-inset-top), not columns down its sides. A popup anchored under the band keeps its own padding from the window's edge; only one anchored in the band (a title-bar control, or a context menu opened in the bar) keeps 8px clear of a corner.
  • 0.103.0 · Breaking ChangesExplanation slots take only a HelperText: FieldDescription, FormSection's description, a ChoiceList item's description, SelectItemDescription, DialogDescription, AlertDialogDescription, DrawerDescription, PopoverDescription, EmptyStateDescription, CardDescription, CardFooter, BannerDescription, DialogFooterNote (work in progress), MessageActionCardHint, MessageActionCardHeaderDescription, MessageActionCardScopeDescription and MessageActionCardActionsNote. A HelperText is made only by helperText(content, { why, about }): content is any ReactNode (a string, a formatted message, a TextLink inside a sentence), why is "consequence", "audience" or "recovery", and about names the thing the line is about. Each slot renders the content with data-why and data-about, and in development warns once when it is given anything else, which it still renders. ToastDescription, NotificationCenterItemBody, EmptyStateTitle, ListRowDescription and the status and data parts are unchanged.
  • 0.102.19 · FixedToast: a × (ToastClose holding an icon, or anything but text) ends the row, after the action; text Dismiss stays before it. ToastClose sets data-content="icon" or "text" and places itself by it.
  • 0.102.9 · AddedToast: useToast() returns the command API (success, error, action, actionTimeout, …) bound to the nearest ToastProvider's manager; toast itself under a provider on the default manager or none. New export ToastCommands.
  • 0.22.0 · Changedtoast command API: toast.info, toast.success, toast.warning and toast.error lead with their intent's icon in ToastIcon instead of a status pixel. The calls, icon: false and leading are unchanged, and a leading node still takes the icon's place.
  • 0.9.6 · Addedtoast.add/info/success/warning/error(title, { leading }) puts a node, such as a person's avatar, in ToastIcon in place of the status pixel. It is aria-hidden and still shows with icon: false. Calls without leading render exactly as before.
  • 0.5.35 · ChangedToastContent measures its rendered content and writes data-has-icon, data-has-description and data-has-actions on itself; the content layout keys off these attributes instead of descendant selectors.