SnackbarsProvider API
Demos
For examples and details on the usage of this React component, visit the component demo pages:
Import
import SnackbarsProvider from '@mui/lab/SnackbarsProvider';
// or
import { SnackbarsProvider } from '@mui/lab';
Props
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
action | func | node | The action to display. It renders after the message, at the end of the snackbar. | |
anchorOrigin | { horizontal: 'center' | 'left' | 'right', vertical: 'bottom' | 'top' } | { vertical: 'bottom', horizontal: 'left' } | The anchor of the Snackbar . On smaller screens, the component grows to occupy all the available width, the horizontal alignment is ignored. |
autoHideDuration | number | null | The number of milliseconds to wait before automatically calling the onClose function. onClose should then set the state of the open prop to hide the Snackbar. This behavior is disabled by default with the null value. |
ClickAwayListenerProps | object | Props applied to the ClickAwayListener element. | |
content | element | func | Replace the SnackbarContent component. | |
ContentProps | object | Props applied to the SnackbarContent element. | |
limit | number | 3 | The maximum number of snackbars to display at a time. |
TransitionComponent | elementType | Grow | The component used for the transition. Follow this guide to learn more about the requirements for this component. |
transitionDuration | number | { appear?: number, enter?: number, exit?: number } | { enter: theme.transitions.duration.enteringScreen, exit: theme.transitions.duration.leavingScreen, } | The duration for the transition, in milliseconds. You may specify a single timeout for all transitions, or individually with an object. |
TransitionProps | object | {} | Props applied to the transition element. By default, the element is based on this Transition component. |
The component cannot hold a ref.