Snackbar
The Snackbar component informs users that an action has been or will be performed by the app.
useSnackbar API
Import
import { useSnackbar } from '@mui/base/useSnackbar';
// or
import { useSnackbar } from '@mui/base';
Name | Type | Default | Description |
---|---|---|---|
autoHideDuration | number | null | null | The number of milliseconds to wait before automatically calling the |
disableWindowBlurListener | boolean | false | If |
onClose | (event: React.SyntheticEvent<any> | Event | null, reason: SnackbarCloseReason) => void | - | Callback fired when the component requests to be closed. Typically |
open | boolean | - | If |
resumeHideDuration | number | - | The number of milliseconds to wait before dismissing after user interaction. If |
Name | Type | Description |
---|---|---|
getRootProps | <ExternalProps extends Record<string, unknown> = {}>(externalProps?: ExternalProps) => UseSnackbarRootSlotProps<ExternalProps> | Resolver for the root slot's props. |
onClickAway | (event: React.SyntheticEvent<any> | Event) => void | Callback fired when a "click away" event is detected. |