A headless drawer primitive for React with modal and non-modal modes, side-aware placement, focus management, portaling, and drag-to-close handles.
import Drawer from "@radui/ui/Drawer"Import all parts of the component and piece them together.
The root component that owns drawer state, modal behavior, snap point state, and child drawer nesting.
| Prop | Type | Default |
|---|---|---|
children | ReactNode | — |
defaultOpen | boolean | false |
open | boolean | — |
onOpenChange | (open: boolean) => void | — |
onOpenChangeComplete | (open: boolean) => void | — |
modal | boolean | 'trap-focus' | true |
swipeDirection | 'left' | 'right' | 'top' | 'bottom' | 'right' |
disablePointerDismissal | boolean | false |
snapPoints | Array<number | string> | [] |
snapPoint | number | string | null | — |
onSnapPointChange | (snapPoint: number | string | null) => void | — |
actionsRef | RefObject<DrawerRootActions | null> | — |
customRootClass | string | '' |
A button-like part that opens the drawer.
| Prop | Type | Default |
|---|---|---|
children | ReactNode | — |
asChild | boolean | false |
className | string | — |
Portals drawer overlay and content outside the normal DOM flow.
| Prop | Type | Default |
|---|---|---|
children | ReactNode | — |
The backdrop layer that can lock scroll and dismiss the drawer.
| Prop | Type | Default |
|---|---|---|
forceMount | boolean | false |
className | string | — |
The positioned drawer panel.
| Prop | Type | Default |
|---|---|---|
children | ReactNode | — |
forceMount | boolean | false |
asChild | boolean | false |
className | string | — |
A heading part for naming the drawer content.
| Prop | Type | Default |
|---|---|---|
children | ReactNode | — |
className | string | — |
A text part for describing the drawer content.
| Prop | Type | Default |
|---|---|---|
children | ReactNode | — |
className | string | — |
A button-like part that closes the drawer intentionally.
| Prop | Type | Default |
|---|---|---|
children | ReactNode | — |
asChild | boolean | false |
className | string | — |
An optional draggable handle that lets users dismiss the drawer by dragging outward.
| Prop | Type | Default |
|---|---|---|
closeThreshold | number | 80 |
className | string | — |
| Shortcut | Description |
|---|---|
| Tab | Moves focus through tabbable controls inside the drawer. Modal drawers keep focus contained until closed. |
| Shift + Tab | Moves focus backward through tabbable controls inside the drawer. Modal drawers keep focus contained until closed. |
| Enter | Activates Drawer.Trigger or Drawer.Close when either control has focus. |
| Space | Activates Drawer.Trigger or Drawer.Close when either control has focus. |
| Escape | Closes the drawer unless outside dismissal is disabled by the root configuration. |
| Reference | What Rad UI follows |
|---|---|
| Dialog modal pattern | Drawer.Content uses dialog semantics and sets aria-modal from the Drawer.Root modal behavior. |
| Dialog labeling | Label Drawer.Content with Drawer.Title and describe it with Drawer.Description using aria-labelledby and aria-describedby. |