Skip to main content
Brand and assets
Build
Monitor and contribute
/
Component library
  • All components
  • Buttons & actions
  • Forms & inputs
  • Layout & containers
  • Overlays
  • Feedback & status
    • AlertNext
    • BadgeDot
    • EmptyPlaceholder
    • Loader
    • Toast
  • Data display
  • Typography
  • Accessibility
  • Contrib
  • Deprecated
  • Feedback & status
  • Toast

Toast

Brief confirmation that something happened. Appears and leaves on its own, so never put anything required in it.

Health
Component health
Source
View on Github
Design
View Figma
Storybook
View in Storybook
Playground
No Example
Accessibility

partially-compliant

Platform
Universal
Accessibility issues
The component has the right aria attributes but does not trap focus when opened.
  • Overview
  • Props
  • Figma

They don't require an action (although they may offer one). They appear temporarily and disappear on their own without requiring user input to be dismissed.

Usage​

Variants​

informative
positive
negative
loading

Close button​

Set showCloseButton to show a close button on the right of the toast. It's off by default. Useful for toasts that stay longer on screen, for example with duration: null.

Options​

On top of the message, variant and action, toast can be customized with following options:

  • id (web-only): string, used to identify toast, required to hide toast imperatively
  • onClose: function called when toast is closed
  • showCloseButton: boolean, set to true to show a close button on the right of the toast. Defaults to false

Some extra options are available but should only be used in rare cases:

  • duration: number in milliseconds, after which toast will be automatically closed. Or set to null to disable automatic closing
  • closeOnClick: boolean, set to false to disable default behavior of closing toast on click/press
  • position: defaults to bottom, but can be set to top to display toast at the top of the screen

Hiding​

Toasts can be imperatively hidden with hideToast function. On web, it can accept a toast id as an argument

Playground​

Loading...
tip
This component is universal, its usage is the same in murray and murray/mobile.

Undocumented props

NameTypeDefault ValueDescriptionUsage count
actionany
messageany
variantany
Edit this page
Previous
Loader
Next
Accordion
  • Usage
  • Variants
  • Close button
  • Options
  • Hiding
  • Playground