Primitives
Primitive

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.

PositionDescription
bottomSlides up from the bottom (default).
topSlides down from the top.
leftSlides in from the left.
rightSlides 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.

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.

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.

Prop

BaseDrawerPopup

Convenience composite that renders Portal + Backdrop + Viewport + Popup. This is the main content wrapper.

Prop

BaseDrawerPanel

Scrollable content area. Wraps ScrollArea and Drawer.Content for text selection support.

Prop

BaseDrawerFooter

Prop

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.

Prop

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.

Prop

Components

ComponentDescription
BaseDrawerRoot component with position context
BaseDrawerTriggerButton that opens the drawer
BaseDrawerPopupConvenience composite (Portal + Backdrop + Viewport + Popup)
BaseDrawerBarDrag handle indicator (adapts orientation per position)
BaseDrawerHeaderContainer for title and description
BaseDrawerTitleAccessible title element
BaseDrawerDescriptionAccessible description element
BaseDrawerPanelScrollable content area with text selection support
BaseDrawerFooterContainer for action buttons
BaseDrawerCloseButton that closes the drawer
BaseDrawerContentPass-through to Drawer.Content for text selection in custom layouts
BaseDrawerMenuNavigation menu container
BaseDrawerMenuItemMenu item button
BaseDrawerMenuTriggerMenu item that opens a nested drawer
BaseDrawerMenuSeparatorMenu divider
BaseDrawerMenuGroupMenu item group
BaseDrawerMenuGroupLabelGroup label
BaseDrawerMenuCheckboxItemCheckbox menu item (default or switch variant)
BaseDrawerMenuRadioGroupRadio group container
BaseDrawerMenuRadioItemRadio menu item
BaseDrawerProviderShared context for indent effect
BaseDrawerIndentApp content wrapper for indent/scale effect
BaseDrawerIndentBackgroundBackground layer behind indent
BaseDrawerSwipeAreaInvisible area for swipe-to-open gestures

CSS Variables

Base UI's Drawer exposes CSS custom properties on the popup element:

VariableDescription
--drawer-swipe-progressProgress toward dismissed (0 = open, 1 = dismissed)
--drawer-swipe-movement-xHorizontal swipe offset in pixels
--drawer-swipe-movement-yVertical swipe offset in pixels
--drawer-swipe-strengthVelocity-based strength (scales exit animation duration)
--drawer-snap-point-offsetVertical offset for snap point positioning
--drawer-heightCurrent drawer height
--drawer-frontmost-heightHeight of the frontmost drawer in a nested stack
--nested-drawersNumber of nested drawers open