Skip to main content

Installation

Or use the CLI:

About

Drawer is built on top of Vaul by @emilkowalski.

Usage

Component API

Drawer

The root drawer component built on Vaul. Props:
  • open - Control drawer open state
  • onOpenChange - Callback when open state changes
  • defaultOpen - Initial open state
  • direction - Direction the drawer opens from (default: "bottom")
    • Options: "top", "right", "bottom", "left"
  • snapPoints - Array of snap points for the drawer
  • modal - Whether drawer is modal (default: true)

DrawerTrigger

The element that opens the drawer.

DrawerContent

The drawer content container. Props:
  • All standard div props
  • Automatically includes drag handle for bottom/top drawers

DrawerHeader

Container for title and description.

DrawerTitle

The drawer title (required for accessibility).

DrawerDescription

The drawer description.

DrawerFooter

Container for drawer actions.

DrawerClose

Closes the drawer.

Examples

Scrollable Content

Keep actions visible while content scrolls:

Different Sides

Use the direction prop to set which side the drawer opens from:

    Responsive Dialog

    Combine Dialog and Drawer for a responsive experience:

    Controlled Drawer

    Control the drawer open state:

    Snap Points

    Define snap points for the drawer:

    Accessibility

    • Built on Vaul for swipe gestures and animations
    • Focus is trapped within the drawer
    • Escape key closes the drawer
    • Background content is inert when modal
    • Screen reader compatible
    • ARIA labels and roles

    API Reference

    See the Vaul documentation for complete API details.