Skip to main content

Toast

The Toast component is used to display a notification message to the user.

Polymorphic Component

By default, content is rendered inside a <div>, but this can be overriden by passing any valid tag name or component with the as prop.

warning

The ToastList component should be placed at the root of your application, and only once. It is responsible for rendering all toasts.

Examples

Basic Toasts

There are five states for a toast: light, dark, success, warning, or critical. The default state is light.

Props

ToastProps

NameTypeDefault ValueRequiredDescription
All attributes of a <div />
autoDismissfalse | truetrueNoShould the toast automatically close?
autoDismissTimeoutnumber6000NoHow long should the toast be visible before it automatically closes?
iconComponentClass<any, any> | FunctionComponent<any> | ReactElement<any, string | JSXElementConstructor<any>> | ForwardRefExoticComponent<any>NoDesired icon to show before the content.
iconSizenull | number | "md" | "lg" | "sm" | "xl" | "xs" | "xxl"NoThe size of the icon.
iconStartComponentClass<any, any> | FunctionComponent<any> | ReactElement<any, string | JSXElementConstructor<any>> | ForwardRefExoticComponent<any>NoDesired icon to show before the content. Same as `icon`. @deprecated
onClose() => voidNoA callback run when the toast asks to close.
state"dark" | "light" | "highlight" | "critical" | "warning" | "success"'light'NoThe state of the highlight.
titleReactNodeNoA title to display before the content.