Drawer

Slide-out panel from any edge. Focus trap, scroll lock, and backdrop. Uses the dialog machine internally.

Example

Props

NameTypeDefaultRequiredDescription
openbooleanRequiredControls drawer visibility
onClose() => voidRequiredCalled when drawer should close
anchor'left' | 'right' | 'top' | 'bottom''right'NoEdge the drawer slides from
size'sm' | 'md' | 'lg''md'NoWidth (horizontal anchors) or height (vertical anchors)
closeOnEscapebooleantrueNoClose when pressing Escape
closeOnBackdropClickbooleantrueNoClose when clicking backdrop

Accessibility

  • role="dialog" with aria-modal="true"
  • Focus trap keeps focus within drawer
  • Body scroll lock while open
  • Returns focus to trigger on close
  • Renders via portal with sibling backdrop

Related Tokens

--drawer-backdrop--drawer-surface--drawer-shadow--drawer-width--drawer-height