Drawer

A panel that slides in from an edge.

Base UI DrawerSource

Bottom drawer

Use a bottom drawer for a secondary task on narrow screens. It opens from the bottom edge by default and shows a grab handle. Swipe down to close it.

Side panel

Use a side panel for details on wide screens. Set swipeDirection="right" on Drawer.Root to open it from the right edge.

Non-modal reference panel

Use this for reference content that the user reads while they work on the page. Set modal={false} to remove the backdrop. Add disablePointerDismissal so page clicks do not close it.

Usage

These are defaults, not laws. Break one when you have a good reason, or when it makes the design more cohesive or more interesting.

  • Use a drawer for a secondary task that keeps the page in view. For a focused task that interrupts the page, use Dialog.
  • Put the body in Drawer.Content and the actions in Drawer.Footer, after the content.
  • Users close a drawer by swiping it toward its edge. Mouse users drag the header.

API

Props that the library adds. Every part also takes all the Base UI props.

Drawer.Root

PropTypeDefaultDescription
modalboolean | 'trap-focus'trueControls modal behavior. false and 'trap-focus' remove the backdrop and allow outside interaction. 'trap-focus' keeps focus in the drawer.

Drawer.Header

PropTypeDefaultDescription
childrenReactNode–The title text. The header labels the drawer with it.
showCloseButtonbooleantrueShows a close button at the right of the header.
classNamestring–Classes for the header.

Drawer.Footer

PropTypeDefaultDescription
separatorbooleanfalseAdds a top divider and equal padding above and below the actions.
childrenReactNode–The actions of the drawer.

Drawer.Popup

PropTypeDefaultDescription
containerHTMLElement | ShadowRoot | RefObject | null–The element that the drawer renders into. The default is the document body.