Toasts can educate people on the content of the screen, provide confirmation when people complete an action, or simply communicate a short message.

Toast is purely visual. In order to properly handle the showing and dismissing of Toasts, as well as any animations, you will need to implement a Toast manager.

also known as Snackbar

Figma:

Web:

iOS:

Android:

Props

Component props
Name
Type
Default
text
Required
string | React.Element<typeof Text>
-

Main content of Toast. Content should be localized. See the Text variant to learn more.

dismissButton
{|
  accessibilityLabel?: string,
  onDismiss: () => void,
|}
-

Adds a dismiss button to Toast. See the Dismissible variant for more info.
The accessibilityLabel should follow the Accessibility guidelines.

{|
  text: string,
  accessibilityLabel: string,
  href: string,
  onClick?: ({|
    event: SyntheticMouseEvent<HTMLAnchorElement> | SyntheticKeyboardEvent<HTMLAnchorElement>,
    dangerouslyDisableOnNavigation: () => void,
  |}) => void,
|}
-

Helper Link to be placed after the subtext. See the helper link variant to learn more.

primaryAction
{|
  accessibilityLabel: string,
  href?: string,
  label: string,
  onClick?: $ElementType<ElementConfig<typeof Button>, "onClick">,
  rel?: $ElementType<ElementConfig<typeof Link>, "rel">,
  size?: $ElementType<ElementConfig<typeof Button>, "size">,
  target?: $ElementType<ElementConfig<typeof Link>, "target">,
|}
-

Adds an optional button for user interaction. Generally not recommended given the ephemeral nature of Toasts.

thumbnail
{| image: React.Element<typeof Image> |}
| {| avatar: React.Element<typeof Avatar> |}
| {| icon: React.Element<typeof Icon> |}
-

An optional thumbnail to display next to the text.

type
"default" | "success" | "error" | "progress"
"default"

See the type variant to learn more.

Usage guidelines

When to use
  • Displaying non-critical feedback on the result of an action.
  • Reinforcing success at the surface level.
When not to use
  • Providing an update related to anything other than confirmation of a successful action. Consider a Callout instead.
  • Presenting mandatory and/or critical actions to a user.
  • Displaying feedback at the element level (e.g., entered password doesn't meet requirements). Use inline text instead.

Accessibility

Localization

Remember to localize text and any string within primaryAction.

Variants

How to display

Toasts should be displayed in the center of the viewport, opposite the main navbar (e.g. at the top of the viewport on mobile, bottom of the viewport on desktop). Though not implemented here, Toasts are meant to be ephemeral and disappear after a few seconds.

Text

The text prop accepts either a string or Text. Use a string for guide toasts without any visual style. Toast will handle the text style and adherence to design guidelines. Regular strings are subject to two-line truncation.

If confirmation toast's text with more complex style is required, such as bold text, inline links, or no truncation, use Text to wrap your message with any additional Text or Link usages contained within. When passing in your own Text component for text, do not specify color on Text. Toast will automatically pick the correct text color for the given type.

Primary action

Dismissable

Type

Thumbnail

Component quality checklist

Component quality checklist
Quality item
Status
Status description
Figma Library
Ready
Component is available in Figma across all platforms.
Responsive Web
Ready
Component is available in code for web and mobile web.
iOS
Component is not currently available in code for iOS.
Android
Component is not currently available in code for Android.