Snackbar
The Snackbar component informs users that an action has been or will be performed by the app.
Snackbar API
Import
import { Snackbar } from '@mui/base/Snackbar';
// or
import { Snackbar } from '@mui/base';
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
autoHideDuration | number | null | The number of milliseconds to wait before automatically calling the |
disableWindowBlurListener | bool | false | If |
exited | bool | true | The prop used to handle exited transition and unmount the component. |
onClose | func | Callback fired when the component requests to be closed. Typically Signature: function(event: React.SyntheticEvent
| |
open | bool | If | |
resumeHideDuration | number | The number of milliseconds to wait before dismissing after user interaction. If | |
slotProps | { clickAwayListener?: func | { children: element, disableReactTree?: bool, mouseEvent?: 'onClick' | 'onMouseDown' | 'onMouseUp' | 'onPointerDown' | 'onPointerUp' | false, onClickAway?: func, touchEvent?: 'onTouchEnd' | 'onTouchStart' | false }, root?: func | object } | {} | The props used for each slot inside the Snackbar. |
slots | { root?: elementType } | {} | The components used for each slot inside the Snackbar. Either a string to use a HTML element or a component. See Slots API below for more details. |
ref
is forwarded to the root element.To learn how to customize the slot, check out the Overriding component structure guide.
Slot name | Class name | Default component | Description |
---|---|---|---|
root | .base-Snackbar-root | 'div' | The component that renders the root. |