Drawer

An interactive element fixed to the edge of the screen.

General

Basic usage.

Placement

Change the placement of the drawer with the placement prop.

Edit profile

A form in a Drawer keeps the page behind it in view. Put the confirm button first and a way out next to it.

APIs

Drawer.Props

AttributeDescriptionTypeAccepted valuesDefault
visibleopen or closeboolean-false
onCloseclose event() => void--
onContentClickevent from modal content(e: MouseEvent) => void--
wrapClassNameclassName of the drawer dialogstring--
keyboardpress Esc to close drawerboolean-true
disableBackdropClickclick background and don't closeboolean-false
placementposition of the drawerDrawerPlacement-right
...native propsHTMLAttributes'name', 'className', ...-

Drawer.Title.Props

AttributeDescriptionTypeAccepted valuesDefault
...native propsHTMLAttributes'id', 'className', ...-

Drawer.Subtitle.Props

AttributeDescriptionTypeAccepted valuesDefault
...native propsHTMLAttributes'id', 'className', ...-

Drawer.Content.Props

AttributeDescriptionTypeAccepted valuesDefault
...native propsHTMLAttributes'id', 'className', ...-

DrawerPlacement

type DrawerPlacement = 'top' | 'bottom' | 'right' | 'left'

Ref

The ref points at the element with role="dialog".

Accessibility

  • • The drawer is aria-modal, and Drawer.Title names it and Drawer.Subtitle describes it. Without a title, pass aria-labelledby.
  • • The focus moves into the drawer when it opens and goes back to the element that had it when it closes. Tab stays inside while it is open.
  • • Escape closes the drawer. Set keyboard={false} to turn that off.
Edit this page on GitHub