Toast
Brief confirmation that something happened. Appears and leaves on its own, so never put anything required in it.
Health
Source
Design
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 imperativelyonClose: function called when toast is closedshowCloseButton: boolean, set totrueto show a close button on the right of the toast. Defaults tofalse
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 tonullto disable automatic closingcloseOnClick: boolean, set tofalseto disable default behavior of closing toast on click/pressposition: defaults tobottom, but can be set totopto 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
| Name | Type | Default Value | Description | Usage count |
|---|---|---|---|---|
| action | any | |||
| message | any | |||
| variant | any |