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.

Demos

For examples and details on the usage of this React component, visit the component demo pages:

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.

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.

Type:

func

Signature:

function(event: object) => void
  • event The event source of the callback.
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.

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

The following class names are useful for styling with CSS (the state classes are marked).
To learn more, visit the component customization page.

.MuiDrawer-rootroot

Styles applied to the root element.

.MuiDrawer-dockeddocked

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

.MuiDrawer-paperpaper

Styles applied to the Paper component.

.MuiDrawer-paperAnchorLeftpaperAnchorLeft

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

.MuiDrawer-paperAnchorRightpaperAnchorRight

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

.MuiDrawer-paperAnchorToppaperAnchorTop

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

.MuiDrawer-paperAnchorBottompaperAnchorBottom

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

.MuiDrawer-paperAnchorDockedLeftpaperAnchorDockedLeft

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

.MuiDrawer-paperAnchorDockedToppaperAnchorDockedTop

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

.MuiDrawer-paperAnchorDockedRightpaperAnchorDockedRight

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

.MuiDrawer-paperAnchorDockedBottompaperAnchorDockedBottom

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

.MuiDrawer-modalmodal

Styles applied to the Modal component.

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