‮Skip to content‬
uiify

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

‮Prop‬‮Type‬‮Default‬‮Description‬
limitnumber3‮Maximum number of toasts kept in the queue; older ones are dropped.‬
childrenReactNode—‮The tree that can call useToast and render a viewport.‬

Toast.Viewport

‮Prop‬‮Type‬‮Default‬‮Description‬
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

‮Prop‬‮Type‬‮Default‬‮Description‬
toast*ToastRecord—‮The queued record to render, with its resolved id, title, description, action, duration and priority.‬

Toast.Title

‮Prop‬‮Type‬‮Default‬‮Description‬
classNamestring—‮Class applied to the title element.‬
childrenReactNode—‮Content of the title.‬

Toast.Description

‮Prop‬‮Type‬‮Default‬‮Description‬
classNamestring—‮Class applied to the description element.‬
childrenReactNode—‮Content of the description.‬

Toast.Action

‮Prop‬‮Type‬‮Default‬‮Description‬
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

‮Prop‬‮Type‬‮Default‬‮Description‬
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)

‮Prop‬‮Type‬‮Default‬‮Description‬
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.‬
durationnumber4000‮Milliseconds 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‬

‮Key‬‮Action‬
Tab‮Focus action buttons inside toast‬
Escape‮Dismiss 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"