Skip to content

SnackbarsProvider API

API reference docs for the React SnackbarsProvider component. Learn about the props, CSS, and other APIs of this exported module.

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';
You can learn about the difference by reading this guide on minimizing bundle size.

Props

Props of the native component are also available.

NameTypeDefaultDescription
actionfunc
| 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.
autoHideDurationnumbernull
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.
ClickAwayListenerPropsobject
Props applied to the ClickAwayListener element.
contentelement
| func
Replace the SnackbarContent component.
ContentPropsobject
Props applied to the SnackbarContent element.
limitnumber3
The maximum number of snackbars to display at a time.
TransitionComponentelementTypeGrow
The component used for the transition. Follow this guide to learn more about the requirements for this component.
transitionDurationnumber
| { 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.
TransitionPropsobject{}
Props applied to the transition element. By default, the element is based on this Transition component.

The component cannot hold a ref.