Snackbar
Imports
import {Snackbar} from 'material-expressive-react';
import {Snackbar} from 'material-expressive-react/snackbar';
Props
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
| action | string | No | Optional action button label. When provided, an action button is rendered. | |
| closeButton | boolean | false | No | Whether to show the close (dismiss) icon button. |
| duration | number | 4000 | No | How long the snackbar stays visible (in ms) before auto‑dismissing. Use SnackbarDuration.INDEFINITE to disable auto‑dismiss. |
| multiLine | boolean | false | No | When true, the snackbar uses a taller multi‑line layoutwith action buttons aligned to the bottom‑end. |
| onAction | (() => void) | No | Callback fired when the action button is clicked. | |
| onClose | (() => void) | No | Callback fired when the close button is clicked. | |
| onDismiss | (() => void) | No | Callback fired when the snackbar is dismissed (by timeout, action, or close). | |
| open | boolean | false | No | Whether the snackbar is visible. Controls the mount/unmount lifecycle. |
| supportingText | string | Yes | The supporting text displayed in the snackbar. |
Events
This component does not explicitly re-emit DOM events via wrapper props.
Slots
Material Web components frequently use named slots. In React, you can pass slot="..." on children (e.g. <Icon slot="icon" />).
If you need to slot a child component that does not accept a slot prop, use the Slotted utility (see Utilities → Slotted).
Examples
See Storybook for live examples and variants.