Base Drawer
A swipe-gesture drawer built on Base UI's official Drawer component with snap points, nested stacking, and indent effects
Base Drawer is a panel that slides in from a screen edge and responds to swipe gestures, with support for snap points, nested stacking, and an indent effect on the background. Use it for mobile-first navigation, filters, or detail panels where dragging to dismiss feels natural.
Preview
Installation
Usage
Composition
Examples
Side Drawer
Use position="right" to slide the drawer in from the side.
Directions
Use position to open the drawer from any screen edge.
| Position | Description |
|---|---|
bottom | Slides up from the bottom (default). |
top | Slides down from the top. |
left | Slides in from the left. |
right | Slides in from the right. |
Controlled
Use the open and onOpenChange props on BaseDrawer to control the open state.
Drawer is closed
Snap Points
Use snapPoints on BaseDrawer to let the drawer rest at multiple heights. Numbers from 0 to 1 are viewport fractions, strings support px and rem units.
Floating Variant
Use variant="floating" on BaseDrawerPopup for inset spacing and fully rounded corners on desktop.
Inset Footer
Use variant="inset" on BaseDrawerFooter to separate the footer with a top border and muted background.
Nested Drawers
Nest drawers to stack them with scale and translate animations, each independently focus managed.
Indent Effect
Use BaseDrawerProvider, BaseDrawerIndentBackground, and BaseDrawerIndent to scale and round the background content when a drawer opens.
The content behind the drawer scales and rounds when the drawer opens.
With Form
Use BaseDrawerPanel to hold form elements; it wraps content in Drawer.Content so text selection works without triggering swipe gestures.
Scrollable Content
Use BaseDrawerPanel for scrollable content that coexists with swipe gestures.
Menu Items
BaseDrawerMenu holds a list of touch-sized rows: use BaseDrawerMenuCheckboxItem for toggles and BaseDrawerMenuRadioGroup for single-choice options, both with their indicator in a reserved right-hand column. Set indicator="switch" on a checkbox item for settings that apply immediately.
Unlike the other menu components, these rows are real checkbox and radio controls rather than Base UI menu items, so each one is individually focusable.
API Reference
Built on Base UI's Drawer. All Base UI Drawer props are supported.
Props
BaseDrawer
Root component that manages drawer state. Wraps Base UI's Drawer.Root.
BaseDrawerPopup
Convenience composite that renders Portal + Backdrop + Viewport + Popup. This is the main content wrapper.
BaseDrawerPanel
Scrollable content area. Wraps ScrollArea and Drawer.Content for text selection support.
BaseDrawerFooter
BaseDrawerMenuCheckboxItem
Toggleable drawer row. Wraps Base UI's Checkbox.Root, so it is a real focusable checkbox rather than a menu item. The indicator sits in a reserved column on the right.
BaseDrawerMenuRadioItem
Single-choice drawer row. Wraps Base UI's Radio.Root and must sit inside a BaseDrawerMenuRadioGroup. Uses the same right-aligned checkmark as BaseDrawerMenuCheckboxItem.
Components
| Component | Description |
|---|---|
BaseDrawer | Root component with position context |
BaseDrawerTrigger | Button that opens the drawer |
BaseDrawerPopup | Convenience composite (Portal + Backdrop + Viewport + Popup) |
BaseDrawerBar | Drag handle indicator (adapts orientation per position) |
BaseDrawerHeader | Container for title and description |
BaseDrawerTitle | Accessible title element |
BaseDrawerDescription | Accessible description element |
BaseDrawerPanel | Scrollable content area with text selection support |
BaseDrawerFooter | Container for action buttons |
BaseDrawerClose | Button that closes the drawer |
BaseDrawerContent | Pass-through to Drawer.Content for text selection in custom layouts |
BaseDrawerMenu | Navigation menu container |
BaseDrawerMenuItem | Menu item button |
BaseDrawerMenuTrigger | Menu item that opens a nested drawer |
BaseDrawerMenuSeparator | Menu divider |
BaseDrawerMenuGroup | Menu item group |
BaseDrawerMenuGroupLabel | Group label |
BaseDrawerMenuCheckboxItem | Checkbox menu item (default or switch variant) |
BaseDrawerMenuRadioGroup | Radio group container |
BaseDrawerMenuRadioItem | Radio menu item |
BaseDrawerProvider | Shared context for indent effect |
BaseDrawerIndent | App content wrapper for indent/scale effect |
BaseDrawerIndentBackground | Background layer behind indent |
BaseDrawerSwipeArea | Invisible area for swipe-to-open gestures |
CSS Variables
Base UI's Drawer exposes CSS custom properties on the popup element:
| Variable | Description |
|---|---|
--drawer-swipe-progress | Progress toward dismissed (0 = open, 1 = dismissed) |
--drawer-swipe-movement-x | Horizontal swipe offset in pixels |
--drawer-swipe-movement-y | Vertical swipe offset in pixels |
--drawer-swipe-strength | Velocity-based strength (scales exit animation duration) |
--drawer-snap-point-offset | Vertical offset for snap point positioning |
--drawer-height | Current drawer height |
--drawer-frontmost-height | Height of the frontmost drawer in a nested stack |
--nested-drawers | Number of nested drawers open |