Skip to content

Toast

Queue of short-lived notifications.

Browsers
Chrome 114+Firefox 125+Safari 17+
Tier
1
Bundle compressed
2.41 kB
Forced layout budget
0 ms
Axe budget
0
SSR compatible
Yes
Published contract
Test harness

Playground

Toast

Viewport

API

Toast.Provider

PropTypeDefaultDescription
limitnumber3Maximum number of toasts kept in the queue; older ones are dropped.
childrenReactNode—The tree that can call useToast and render a viewport.

Toast.Viewport

PropTypeDefaultDescription
aria-labelstring—Accessible name for the region that holds the queued toasts.
classNamestring—Class applied to the viewport element.
popover"manual"—Set by the live client viewport so the rendered queue sits in the top layer; the server shell leaves it unset.
refRef<HTMLElement>—Ref to the viewport element.
childrenReactNode—Extra content rendered inside the viewport alongside the queued toasts.

Toast.Root

PropTypeDefaultDescription
toast*ToastRecord—The queued record to render, with its resolved id, title, description, action, duration and priority.

Toast.Title

PropTypeDefaultDescription
classNamestring—Class applied to the title element.
childrenReactNode—Content of the title.

Toast.Description

PropTypeDefaultDescription
classNamestring—Class applied to the description element.
childrenReactNode—Content of the description.

Toast.Action

PropTypeDefaultDescription
classNamestring—Class applied to the action button.
onClick(event: MouseEvent<HTMLButtonElement>) => void—Called when the action button is clicked.
childrenReactNode—Content of the action button.

Toast.Close

PropTypeDefaultDescription
classNamestring—Class applied to the close button.
onClick(event: MouseEvent<HTMLButtonElement>) => void—Called when the close button is clicked.
childrenReactNode—Content of the close button.

useToast().toast(input)

PropTypeDefaultDescription
titleReactNode—Title line of the toast.
descriptionReactNode—Supporting line under the title.
action{ label: ReactNode; onClick: () => void }—Label and handler for a single action button on the toast.
durationnumber4000Milliseconds before the toast dismisses itself; zero or less keeps it until dismissed.
priority"polite" | "assertive""polite"Which live region announces the toast.
idstring—Id for the toast; generated when omitted.

Keyboard

KeyAction
TabFocus action buttons inside toast
EscapeDismiss when closable

Accessibility

Live region polite/assertive announcements; enqueue does not move focus, and hover/focus pause automatic dismissal.

Styling hooks

data-statedata-part="item"data-part="title"data-part="description"data-part="action"data-part="close"