Skip to content

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';
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

Props of the native component are also available.

anchor

Side from which the drawer will appear.

Type:'bottom'
| 'left'
| 'right'
| 'top'

Default:'left'


children

The content of the component.

Type:node


classes

Override or extend the styles applied to the component.

See CSS API below for more details.

Type:object


elevation

The elevation of the drawer.

Type:integer

Default:16


hideBackdrop

If true, the backdrop is not rendered.

Type:bool

Default:false


ModalProps

Props applied to the Modal element.

Type:object

Default:{}


onClose

Callback fired when the component requests to be closed. The reason parameter can optionally be used to control the response to onClose.

Type:func

Signature:
function(event: object, reason: string) => void
  • event The event source of the callback.
  • reason Can be: "escapeKeyDown", "backdropClick".

open

If true, the component is shown.

Type:bool

Default:false


PaperProps

Props applied to the Paper element.

Type:object

Default:{}


SlideProps

Props applied to the Slide element.

Type:object


sx

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


transitionDuration

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, }


variant

The variant to use.

Type:'permanent'
| 'persistent'
| 'temporary'

Default:'temporary'


The 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.


CSS classes

These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.

.MuiDrawer-docked

Styles applied to the root element if variant="permanent or persistent".

Rule name:docked


.MuiDrawer-modal

Styles applied to the Modal component.

Rule name:modal


.MuiDrawer-paper

Styles applied to the Paper component.

Rule name:paper


.MuiDrawer-paperAnchorBottom

Styles applied to the Paper component if anchor="bottom".

Rule name:paperAnchorBottom


.MuiDrawer-paperAnchorDockedBottom

Styles applied to the Paper component if anchor="bottom" and variant is not "temporary".

Rule name:paperAnchorDockedBottom


.MuiDrawer-paperAnchorDockedLeft

Styles applied to the Paper component if anchor="left" and variant is not "temporary".

Rule name:paperAnchorDockedLeft


.MuiDrawer-paperAnchorDockedRight

Styles applied to the Paper component if anchor="right" and variant is not "temporary".

Rule name:paperAnchorDockedRight


.MuiDrawer-paperAnchorDockedTop

Styles applied to the Paper component if anchor="top" and variant is not "temporary".

Rule name:paperAnchorDockedTop


.MuiDrawer-paperAnchorLeft

Styles applied to the Paper component if anchor="left".

Rule name:paperAnchorLeft


.MuiDrawer-paperAnchorRight

Styles applied to the Paper component if anchor="right".

Rule name:paperAnchorRight


.MuiDrawer-paperAnchorTop

Styles applied to the Paper component if anchor="top".

Rule name:paperAnchorTop


.MuiDrawer-root

Styles applied to the root element.

Rule name:root



You can override the style of the component using one of these customization options:

Edit this page

Was this page helpful?


DividerFab

Blog

Store