notistack

SnackbarProvider
NameTypeDefaultDescription
classes
object
Override or extend the styles applied to the component.
maxSnack
number
3
Maximum snackbars that can be stacked on top of one another.
dense
bool
false
Denser margins for snackbars. Recommended to be used on mobile devices
hideIconVariant
bool
false
Hides iconVariant if set to `true`.
iconVariant
{ success?: any, warning?: any, error?: any, info?: any }
{}
Little icon that is displayed at left corner of a snackbar.
...plus all other props than can be passed as both SnackbarProvider props or enqueueSnackbar options.
enqueueSnackbar options
NameTypeDefaultDescription
key
union: { string | number }
Unique identifier for this snackbar.
variant
enum: { 'default' | 'success' | 'error' | 'info' }
'default'
Different type of snackbars.
persist
bool
false
Snackbar stays on the screen, unless it is dismissed (programmatically or through user interaction).
children
element
Replace the snackbar. Can be used to entirely customize snackbars.
...plus all other props than can be passed as both SnackbarProvider props or enqueueSnackbar options.
Mutual props
These props can be passed in SnackbarProvider props, as well as options parameter of enqueueSnackbar.
NameTypeDefaultDescription
children*
node
Most of the time, this is your App. every component from this point onward will be able to show snackbars.
preventDuplicate
bool
false
Ignores displaying multiple snackbars with the same `message`
action
func
Callback to get action(s). actions are mostly buttons displayed in Snackbar. @param {string|number} key key of a snackbar
anchorOrigin
{ horizontal: enum: { 'left' | 'center' | 'right' } , vertical: enum: { 'top' | 'bottom' } }
{ vertical: 'bottom', horizontal: 'left', }
The anchor of the `Snackbar`.
autoHideDuration
number
5000
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.
disableWindowBlurListener
bool
If `true`, the `autoHideDuration` timer will expire even if the window is not focused.
onClose
func
Callback fired when the component requests to be closed. The `reason` parameter can optionally be used to control the response to `onClose`, for example ignoring `clickaway`. @param {object} event The event source of the callback @param {string} reason Can be:`"timeout"` (`autoHideDuration` expired) or: `"clickaway"` or: `"maxsnack"` (snackbar is closed because `maxSnack` has reached.) @param {string|number} key key of a Snackbar
onEnter
func
Callback fired before the transition is entering.
onEntered
func
Callback fired when the transition has entered.
onEntering
func
Callback fired when the transition is entering.
onExit
func
Callback fired before the transition is exiting.
onExited
func
Callback fired when the transition has exited.
onExiting
func
Callback fired when the transition is exiting.
resumeHideDuration
number
The number of milliseconds to wait before dismissing after user interaction. If `autoHideDuration` property isn't specified, it does nothing. If `autoHideDuration` property is specified but `resumeHideDuration` isn't, we default to `autoHideDuration / 2` ms.
TransitionComponent
elementType
Slide
The component used for the transition.
transitionDuration
union: { number | { enter?: number, exit?: number } }
The duration for the transition, in milliseconds. You may specify a single timeout for all transitions, or individually with an object.
Part of this documentation was taken from material-ui website.