SnackbarProvider
ComponentUnless otherwise noted, any of these props can be overridden for a specific snackbar instance by adding that same property to the object passed to createSnackbar
.
Name | Type | Default | Description |
---|---|---|---|
animationTimeout | number | 500 | The duration of the show and hide animations, in milliseconds |
component | React component type | Snackbar component | The component type to use for rendering the snackbar. Cannot be overridden for an individual snackbar. |
dismissable | boolean | false | Whether or not created snackbars can be manually dismissed by the user |
pauseOnHover | boolean | false | Whether or not to pause a snackbar's timeout when the mouse is hovered over it |
position | One of:
| 'bottom' | The position on screen to show the snackbars. Cannot be overridden for an individual snackbar. |
progressBar | boolean | true | Whether or not to show an animated progress bar indicating the time before a snackbar is removed |
sticky | boolean | false | Whether or not the snackbars should be sticky |
timeout | number | 3000 | The time before a snackbar is automatically removed, in milliseconds |
createSnackbar(snackbar: SnackbarData)
Creates and shows a snackbar notification.
SnackbarData
typeSnackbarManager
component and a SnackbarData
item, the value in the SnackbarData
takes precedence. Otherwise, it will default to the corresponding setting in the SnackbarManager
if not specified.Name | Type | Description |
---|---|---|
animationTimeout | number | The duration of the show and hide animations, in milliseconds |
data | object | Custom data that can be used with a custom snackbar component |
dismissable | boolean | Whether or not this snackbar can be manually dismissed by the user |
message (Required) | string | The message to display |
pauseOnHover | boolean | Whether or not to pause this snackbar's timeout when it is hovered over |
progressBar | boolean | Whether or not to show the progress bar for this snackbar |
sticky | boolean | Whether or not this snackbar should be sticky. Sticky snackbars are not automatically removed. |
theme | One of:
| The theme to use for this snackbar. Default is 'default' . |
timeout | number | The time before this snackbar is automatically removed, in milliseconds |
wrapComponent
helperThis helper function wraps the passed component, adding the createSnackbar
function prop to the wrapped component.