Skip to main content

Drawer

StorybookView in Storybook

Explore interactive examples and all component variations in our Storybook.

The Drawer component is a panel that slides in from any edge of the screen — bottom, top, left, or right. It is ideal for mobile-friendly bottom sheets, side navigation panels, confirmation dialogs, and forms that need more space than a modal dialog.

Bottom Sheet

Right Panel

With Form

Direction Variants

Properties

Drawer

PropertyTypeDefaultDescription
openboolean-Controlled open state of the drawer.
onOpenChange(open: boolean) => void-Callback fired when the open state changes.
childrenReactNode-Must include DrawerTrigger and DrawerContent.

DrawerContent

PropertyTypeDefaultDescription
direction"top" | "bottom" | "left" | "right""bottom"Edge from which the drawer slides in.
classNamestring-Additional CSS classes.
childrenReactNode-Drawer body, typically DrawerHeader, content, and DrawerFooter.

DrawerTrigger

PropertyTypeDefaultDescription
asChildbooleanfalseMerges props onto the immediate child element instead of rendering a wrapper.
childrenReactNode-The element that opens the drawer on click.

DrawerClose

PropertyTypeDefaultDescription
asChildbooleanfalseMerges props onto the immediate child element.
childrenReactNode-The element that closes the drawer on click.

DrawerHeader

PropertyTypeDefaultDescription
classNamestring-Additional CSS classes.
childrenReactNode-Typically DrawerTitle and DrawerDescription.

DrawerFooter

PropertyTypeDefaultDescription
classNamestring-Additional CSS classes.
childrenReactNode-Action buttons, typically DrawerClose and a primary action.

DrawerTitle

PropertyTypeDefaultDescription
classNamestring-Additional CSS classes.
childrenReactNode-Title text for the drawer.

DrawerDescription

PropertyTypeDefaultDescription
classNamestring-Additional CSS classes.
childrenReactNode-Supplementary description text.

Features

Direction Control

The direction prop on DrawerContent determines which screen edge the panel slides from. All four directions — top, bottom, left, and right — are supported.

Controlled State

The Drawer component is fully controlled via open and onOpenChange, giving you precise control over open/close logic including confirmation dialogs or form validation before closing.

Portal Rendering

DrawerPortal renders the content outside the normal DOM tree, preventing clipping issues with overflow: hidden parent elements.

Common Use Cases

  • Bottom sheets — mobile-style action sheets and order summaries
  • Side navigation — collapsible left or right navigation drawers
  • Detail panels — contextual information panels that slide in alongside content
  • Forms — data entry forms with more space than a dialog
  • Confirmations — actions that require confirmation before proceeding