import Drawer from '@mui/material/Drawer';
// or
import { Drawer } from '@mui/material';
Learn about the difference by reading this guide on minimizing bundle size.
The props of the Modal component are available when variant="temporary"
is set.
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
anchor | ‘bottom’ | ‘left’ | ‘right’ | ‘top’ | ‘left’ | Side from which the drawer will appear. |
children | node | - | The content of the component. |
classes | object | - | Override or extend the styles applied to the component. See CSS classes API below for more details. |
elevation | integer | 16 | The elevation of the drawer. |
hideBackdrop | bool | false | If true , the backdrop is not rendered. |
ModalProps | object | {} | Props applied to the Modal element. |
onClose | func | - | Callback fired when the component requests to be closed. The reason parameter can optionally be used to control the response to onClose . Signature: function(event: object, reason: string) => void |
open | bool | false | If true , the component is shown. |
PaperProps | object | {} | Props applied to the Paper element. |
SlideProps | object | - | Props applied to the Slide element. |
sx | Array<func | object | bool> | func | object | - | The system prop that allows defining system overrides as well as additional CSS styles. See the sx page for more details. |
transitionDuration | number | { 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. |
variant | ‘permanent’ | ‘persistent’ | ‘temporary’ | ‘temporary’ | The variant to use. |
The ref
is forwarded to the root element.
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.
Class name | Rule name | Description |
---|---|---|
.MuiDrawer-docked | docked | Styles applied to the root element if variant="permanent or persistent" . |
.MuiDrawer-modal | modal | Styles applied to the Modal component. |
.MuiDrawer-paper | paper | Styles applied to the Paper component. |
.MuiDrawer-paperAnchorBottom | paperAnchorBottom | Styles applied to the Paper component if anchor="bottom" . |
.MuiDrawer-paperAnchorDockedBottom | paperAnchorDockedBottom | Styles applied to the Paper component if anchor="bottom" and variant is not “temporary”. |
.MuiDrawer-paperAnchorDockedLeft | paperAnchorDockedLeft | Styles applied to the Paper component if anchor="left" and variant is not “temporary”. |
.MuiDrawer-paperAnchorDockedRight | paperAnchorDockedRight | Styles applied to the Paper component if anchor="right" and variant is not “temporary”. |
.MuiDrawer-paperAnchorDockedTop | paperAnchorDockedTop | Styles applied to the Paper component if anchor="top" and variant is not “temporary”. |
.MuiDrawer-paperAnchorLeft | paperAnchorLeft | Styles applied to the Paper component if anchor="left" . |
.MuiDrawer-paperAnchorRight | paperAnchorRight | Styles applied to the Paper component if anchor="right" . |
.MuiDrawer-paperAnchorTop | paperAnchorTop | Styles applied to the Paper component if anchor="top" . |
.MuiDrawer-root | root | Styles applied to the root element. |
You can override the style of the component using one of these customization options:
styleOverrides
property in a custom theme.If you did not find the information in this page, consider having a look at the implementation of the component for more detail.