Toast

A React component in Beamline's Overlays category, in the free sample.

Short results of an action stacked at an edge: point at the stack to fan it out and pause the timers; undo or retry in place; Alt+T, Escape and a swipe for the keyboard and touch.

Use it for

  • Brief results of an action: saved, sent, failed with retry, undo, a long task finishing.

Not for

Anatomy

  • ToastStackProvider
  • ToastStack (region)
  • card: icon, title, description, action
  • dismiss button
  • useToastStack(): toast, update, dismiss

Variants

  • type: success, error, warning, info, loading
  • position: bottom-right, bottom-left, bottom-center, top-right, top-left, top-center

States

  • entering
  • front
  • behind (peeking)
  • fanned out
  • paused
  • updating (new mark and words in place)
  • leaving
  • swiping (thrown out on release)
  • narrow card (under 18rem: the action moves under the text)

Keyboard

  • Alt+T focuses the newest toast
  • Tab moves through toasts and their actions
  • Escape dismisses the focused toast
  • Dismissed cards leave the focus order immediately while their exit animation finishes.

Motion

Cards arrive from the edge and fan out on --pui-ease-drawer over --pui-duration-considered. Leaving on its own (timer, ×, Escape) a card fades over --pui-motion-out and sinks a little; swiped past the threshold it keeps going the way it was thrown while it fades, instead of springing back. An update (loading → success) brings the new mark in from the middle and fades the new words in where the old ones stood. Reduced motion: arrivals and departures are instant, the update fades.

Props

PropTypeDefaultDescription
toast(input){ id?, type?, title, description?, action?: { label, onClick }, duration? } → id—
update(id, patch)Partial<ToastInput>—
dismiss(id?)string—
positionToastPosition"bottom-right"
containedbooleanfalsePosition inside the nearest positioned parent instead of the viewport (a panel, a demo).
visibleToastsnumber3Cards visible while collapsed: the newest and the ones peeking behind it.
hotkeybooleantrueAlt+T moves focus to the newest toast.
style / refCSSProperties / native Ref—style: Inline styles on the documented visual root; no overrides by default. ref: Receives the documented native target or imperative handle; omitted by default.
classNamesToastStackClassNames—Classes for the named visual parts; no overrides by default.
refRef<HTMLElement>—Receives the documented native target or imperative handle; omitted by default.
styleCSSProperties—Inline styles on the documented visual root; no overrides by default.
labelstring—The region's name for assistive tech.
classNamestring—Classes on the documented visual root; no override by default.
ToastStackProvider.children (required)ReactNode—
ToastStackProvider.maxnumber—

Built from

Used in

Dependencies

lucide-react

Import

import { ToastStack, ToastStackProvider, useToastStack } from "@beamline/toast";

Get it

Toast is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Toast is included in the free MIT sample. Get Beamline · Connect your agent

More in Overlays

  • Command menu: Search-first list of every action: ranked matching, groups, keycap shortcuts and nested pages; inline as CommandPalette or in a ⌘K dialog as CommandMenu.
  • Share dialog: Share a document, board or project: invite people by name or email with the access they get, change or remove anyone's access in place, and set who the…
  • Context menu: Actions for an object on right-click, long-press, Shift+F10 or the menu key, opened at the pointer, with the same rows as the dropdown menu.
  • Hover card: A preview of a person, link or record on hover or keyboard focus, without leaving the page; HoverCardProfile is the standard person preview.
  • Product tour: A short guided tour over the real interface: a spotlight that glides from one element to the next while the rest of the screen dims, and a card beside…
  • Bottom sheet: A phone panel that rests at a peek and follows the finger to full height; a flick down closes it, and the handle works from the keyboard.
  • Sheet: A panel that slides in from an edge with the page still visible behind it: header and footer stay put while the body scrolls.
  • Dropdown menu: A list of actions behind a trigger, with shortcuts, check items, headings and submenus; one highlight glides under the pointer and jumps with the keyboard.
  • Dialog: A focused task over the page (create, invite, rename) with a title, body and footer; focus moves in, is trapped and returns on close.
  • Alert Dialog: A blocking confirmation that must be answered: the scrim does not dismiss it, focus starts on the safe choice, and an async action keeps it open until…
  • Popover: A small surface anchored to a trigger for a short form, a filter or an explanation; focus moves in and returns on close.
  • Tooltip: Short supporting text for a control: opens after a moment on hover and at once on keyboard focus; inside a toolbar group the next one opens instantly.

Part of Beamline UI: polished, editable React components and complete screens for custom applications. Build your own style from any look; tokens, fonts, radii, motion; not only colours.