Skip to content

Drawer API

The API documentation of the Drawer React component. Learn more about the properties and the CSS customization points.

import Drawer from '@material-ui/core/Drawer';

The properties of the Modal component are available when variant="temporary" is set.

Props

Name Type Default Description
anchor enum: 'left' |
 'top' |
 'right' |
 'bottom'
'left' Side from which the drawer will appear.
children node The contents of the drawer.
classes object Override or extend the styles applied to the component. See CSS API below for more details.
elevation number 16 The elevation of the drawer.
ModalProps object {} Properties applied to the Modal element.
onClose func Callback fired when the component requests to be closed.

Signature:
function(event: object) => void
event: The event source of the callback
open bool false If true, the drawer is open.
PaperProps object Properties applied to the Paper element.
SlideProps object Properties applied to the Slide element.
transitionDuration union: number |
 { enter?: number, exit?: number }
{ enter: duration.enteringScreen, exit: duration.leavingScreen } The duration for the transition, in milliseconds. You may specify a single timeout for all transitions, or individually with an object.
variant enum: 'permanent' |
 'persistent' |
 'temporary'
'temporary' The variant to use.

The ref is forwarded to the root element.

Any other properties supplied will be provided to the root element (native element).

CSS

You can override all the class names injected by Material-UI thanks to the classes property. This property accepts the following keys:

Name Description
root Styles applied to the root element.
docked Styles applied to the root element if variant="permanent or persistent".
paper Styles applied to the Paper component.
paperAnchorLeft Styles applied to the Paper component if anchor="left".
paperAnchorRight Styles applied to the Paper component if anchor="right".
paperAnchorTop Styles applied to the Paper component if anchor="top".
paperAnchorBottom Styles applied to the Paper component if anchor="bottom".
paperAnchorDockedLeft Styles applied to the Paper component if anchor="left" & variant is not "temporary".
paperAnchorDockedTop Styles applied to the Paper component if anchor="top" & variant is not "temporary".
paperAnchorDockedRight Styles applied to the Paper component if anchor="right" & variant is not "temporary".
paperAnchorDockedBottom Styles applied to the Paper component if anchor="bottom" & variant is not "temporary".
modal Styles applied to the Modal component.

Have a look at the overriding styles with classes section and the implementation of the component for more detail.

If using the overrides key of the theme, you need to use the following style sheet name: MuiDrawer.

Notes

The component can cause issues in StrictMode.

Demos