Drawer API
API reference docs for the React Drawer component. Learn about the props, CSS, and other APIs of this exported module.
Component demos
Import
import Drawer from '@mui/material/Drawer';
// or
import { Drawer } from '@mui/material';
The props of the Modal component are available
when variant="temporary"
is set.
Props of the native component are also available.
Override or extend the styles applied to the component.
See CSS API below for more details.
Type:object
Callback fired when the component requests to be closed. The reason
parameter can optionally be used to control the response to onClose
.
Type:func
function(event: object, reason: string) => void
event
The event source of the callback.reason
Can be:"escapeKeyDown"
,"backdropClick"
.
The system prop that allows defining system overrides as well as additional CSS styles.
See the `sx` page for more details.
Type:Array<func
| object
| bool>
| func
| object
The duration for the transition, in milliseconds. You may specify a single timeout for all transitions, or individually with an object.
Type:number
| { appear?: number, enter?: number, exit?: number }
Default:{
enter: theme.transitions.duration.enteringScreen,
exit: theme.transitions.duration.leavingScreen,
}
ref
is forwarded to the root element.Theme default props
You can use MuiDrawer
to change the default props of this component with the theme.
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
Styles applied to the root element if variant="permanent or persistent"
.
Rule name:docked
Styles applied to the Paper component if anchor="bottom"
.
Rule name:paperAnchorBottom
Styles applied to the Paper component if anchor="bottom"
and variant
is not "temporary".
Rule name:paperAnchorDockedBottom
Styles applied to the Paper component if anchor="left"
and variant
is not "temporary".
Rule name:paperAnchorDockedLeft
Styles applied to the Paper component if anchor="right"
and variant
is not "temporary".
Rule name:paperAnchorDockedRight
Styles applied to the Paper component if anchor="top"
and variant
is not "temporary".
Rule name:paperAnchorDockedTop
Styles applied to the Paper component if anchor="left"
.
Rule name:paperAnchorLeft
Styles applied to the Paper component if anchor="right"
.
Rule name:paperAnchorRight
Styles applied to the Paper component if anchor="top"
.
Rule name:paperAnchorTop
You can override the style of the component using one of these customization options:
- With a global class name.
- With a rule name as part of the component's
styleOverrides
property in a custom theme.