Skip to main content
Toast renders one notification. Your application controls when it appears, its position, and when it is removed.

Dismissible notification

onClose is called by the close button and when the countdown completes. Remove the toast in that callback. The countdown defaults to 6,000 milliseconds and pauses while the pointer is over the toast.

Progress and cancellation

Passing progress supplies a percentage and disables the countdown. Cancellation invokes onCancel; the parent owns cancellation and removal. action accepts a React node for a footer action.

Appearance and announcements

variant accepts default, error, success, info, or warning. Each variant supplies an icon and theme colors. Use icon to replace the icon and iconLabel when the default icon needs its own accessible name. The default role is status with polite announcements. Use role="alert" for urgent feedback. Set cancelLabel and closeLabel to localize the controls, and allow enough time to read the content or interact with its actions.

Props

The reference is generated from the public component types. Native attributes, including accessible names and event handlers, are also accepted on parts that render elements.
ReactNode
Content rendered in the footer, such as an action button.
string
default:"Cancel"
Label of the cancel button.
string
default:"Close"
Accessible name of the close button.
ReactNode
Supporting content rendered below the message.
number
default:"6000"
Milliseconds before onClose is called. The countdown pauses while the pointer is over the toast.
ReactNode
Replaces the variant’s icon.
string
Accessible name of the default icon. Without it, the icon is hidden from assistive technology.
(() => void)
Called when the cancel button is clicked. The button renders only when this callback is provided.
(() => void)
Called when the close button is clicked or the countdown completes. The button renders only when this callback is provided.
number
Completion percentage shown in the progress bar. When set, the countdown is disabled.
RenderProp<Record<string, unknown>>
Replaces the rendered element or composes it with another component. Accepts a React element or a function that returns the element to render.
"success" | "warning" | "default" | "error" | "info"
default:"default"
Visual variant that selects the icon and colors.