
Bottom sheet drawer with swipe-to-dismiss and smooth spring animations.
npx shadcn@latest add https://ui.edbn.me/api/analytics/registry/drawer.jsonProvides shared context for global drawer UI such as indent effects.
childrenReactNodeProvider content
Groups all parts of the drawer. Doesn't render its own HTML element.
defaultOpenbooleanfalseInitial open state
openbooleanControlled open state
onOpenChangefunctionCalled when state changes
onOpenChangeComplete(open: boolean) => voidCalled after open/close animations complete
actionsRefRefObject<Drawer.Root.Actions | null>Imperative close and unmount actions
handleDrawer.Handle<Payload>Handle for detached triggers
defaultTriggerIdstring | nullInitial associated trigger id
triggerIdstring | nullControlled associated trigger id
snapPointsDrawerSnapPoint[]Snap point heights
defaultSnapPointDrawerSnapPoint | nullInitial uncontrolled snap point
snapPointDrawerSnapPoint | nullControlled snap point
onSnapPointChangefunctionCalled when snap point changes
snapToSequentialPointsbooleanfalseDisable velocity-based snap point skipping
swipeDirectionDrawerSwipeDirection'down'Direction that dismisses drawer
modalboolean | 'trap-focus'trueFocus trap and backdrop dismiss
disablePointerDismissalbooleanfalseDisable backdrop dismiss
childrenReactNode | functionDrawer content
A button that opens the drawer. Renders a button element.
handleDrawer.Handle<Payload>Associates this trigger with a detached root
payloadPayloadPayload passed to a render-child root
idstringElement and active trigger id
nativeButtonbooleantrueRender as native button
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
Moves the popup to a different part of the DOM. Renders a div element.
containerHTMLElement | ShadowRoot | RefObject | nullPortal container
keepMountedbooleanfalseKeep in DOM when closed
An overlay displayed beneath the popup. Renders a div element.
forceRenderbooleanfalseForce rendering even when nested
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-open | Present when drawer is open |
| data-closed | Present when drawer is closed |
| data-starting-style | Present when animating in |
| data-ending-style | Present when animating out |
| data-swiping | Present while a swipe gesture is active |
| Variable | Description |
|---|---|
| --drawer-swipe-progress | Swipe progress of the drawer gesture |
| --drawer-swipe-strength | Scalar for swipe release transition timing |
A container for the drawer contents. Renders a div element.
initialFocusboolean | RefObject<HTMLElement> | functionElement to focus on open
finalFocusboolean | RefObject<HTMLElement> | functionElement to focus on close
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-open | Present when drawer is open |
| data-closed | Present when drawer is closed |
| data-expanded | Present at expanded snap point |
| data-nested-drawer-open | Present when a nested drawer is open |
| data-nested-drawer-swiping | Present when a nested drawer is being swiped |
| data-swipe-direction | Indicates swipe direction |
| data-swipe-dismiss | Present when dismissed by swiping |
| data-swiping | Present when being swiped |
| data-starting-style | Present when animating in |
| data-ending-style | Present when animating out |
| Variable | Description |
|---|---|
| --drawer-frontmost-height | Height of the frontmost open drawer |
| --drawer-height | Height of the drawer popup |
| --drawer-snap-point-offset | Snap point offset for translation |
| --drawer-swipe-movement-x | Swipe movement on X axis |
| --drawer-swipe-movement-y | Swipe movement on Y axis |
| --drawer-swipe-strength | Scalar for swipe release transition |
| --nested-drawers | Number of nested drawers open |
A container for the drawer contents. Renders a div element.
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
A heading that labels the drawer. Renders an h2 element.
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
Additional information about the drawer. Renders a p element.
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
A button that closes the drawer. Renders a button element.
nativeButtonbooleantrueRender as native button
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
A positioning container for the drawer popup. Renders a div element.
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-open | Present when drawer is open |
| data-closed | Present when drawer is closed |
| data-nested | Present when nested within another drawer |
| data-starting-style | Present when animating in |
| data-ending-style | Present when animating out |
An invisible area that listens for swipe gestures to open the drawer. Renders a div element.
swipeDirectionDrawerSwipeDirectionopposite of Root swipeDirectionDirection that opens the drawer
disabledbooleanfalseDisable the swipe area
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-open | Present when drawer is open |
| data-closed | Present when drawer is closed |
| data-disabled | Present when disabled |
| data-swipe-direction | Indicates swipe direction |
| data-swiping | Present when being swiped |
A wrapper for host UI that can indent while any drawer in the nearest provider is open.
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-active | Present when any drawer in the provider is open |
A background layer paired with DrawerIndent for the latest indent effect.
classNamestring | functionCSS class name
styleCSSProperties | functionInline style or state-based style function
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-active | Present when any drawer in the provider is open |
Base UI handle utility for detached triggers and imperative drawer control.
isOpenbooleanreadonlyWhether the associated drawer is open
open(triggerId: string | null) => voidmethodOpen and associate the drawer with a trigger id
openWithPayload(payload: Payload) => voidmethodOpen with payload for render-child drawer roots
close() => voidmethodClose the associated drawer
EDBN-only decorative visual grip for bottom drawers. Renders an aria-hidden div.
classNamestringCSS class name