Drawer

Animated slide-out panel that opens from any side of the viewport with spring animation, backdrop dismiss, and focus trap.

Open in v0

Last updated: March 29, 2026

Installation

npx smoothui-cli add drawer

Features

  • Opens from all 4 sides: top, right, bottom, left
  • Controlled open and onOpenChange props
  • Backdrop click to dismiss
  • Escape key to dismiss
  • Focus trap within the drawer
  • Title and description slots
  • Footer slot for action buttons
  • Spring animation with reduced motion support

Accessibility

Keyboard Interactions

KeyDescription
EscapeCloses the drawer
TabCycles focus through focusable elements within the drawer (focus is trapped)
Shift + TabCycles focus backward through focusable elements within the drawer

ARIA Attributes

AttributeElementPurpose
role="dialog"Drawer contentIdentifies the element as a dialog
aria-labelledbyDrawer contentReferences the drawer title for an accessible name
aria-describedbyDrawer contentReferences the drawer description

Reduced Motion

This component respects the prefers-reduced-motion media query via useReducedMotion from Motion. When reduced motion is preferred, all slide and fade animations are disabled instantly.

Props

DrawerSide