Drawer
React drawer that slides in from the inline start, inline end, or bottom for settings, detail panels, and filter forms. Same focus handling as Modal, RTL-aware sides.
Drawer slides a panel from the screen edge, with the same focus and ESC behavior as Modal. side is logical, so start/end flip with direction.
When to use
Use Drawer for secondary flows that need more room than a Modal: editing settings, viewing a record's details, or a filter form. Use the bottom sheet on mobile for short pickers.
Because side is logical, start and end swap in RTL. Keep the page behind it visible so users keep their context.
Examples
Props
Props declared by Drawer. Native attributes of the underlying element pass through.
<Drawer>
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | ||
open | boolean | ||
defaultOpen | boolean | ||
onOpenChange | (open: boolean) => void | ||
modal | boolean |
<DrawerTrigger>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean |
<DrawerClose>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean |
<DrawerContent>
| Prop | Type | Default | Description |
|---|---|---|---|
side | "start" | "end" | "top" | "bottom" | ||
size | "sm" | "md" | "lg" | "full" | ||
showCloseButton | boolean | Show the corner X close button. Defaults to true. | |
closeLabel | string | Localized aria-label for the close button. Defaults to "Close". | |
forceMount | true | Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries. | |
onOpenAutoFocus | (event: Event) => void | Event handler called when auto-focusing on open. Can be prevented. | |
onCloseAutoFocus | (event: Event) => void | Event handler called when auto-focusing on close. Can be prevented. | |
deferPointerDownOutside | boolean | When true, a 'pointerdown' event outside of the layered element will
wait for the interaction's click event before dispatching, allowing
third-party code to stop propagation of later events and cancel dismissal. | |
onEscapeKeyDown | (event: KeyboardEvent) => void | Event handler called when the escape key is down. Can be prevented. | |
onPointerDownOutside | (event: PointerDownOutsideEvent) => void | Event handler called when the a pointerdown event happens outside of the DismissableLayer.
Can be prevented. | |
onFocusOutside | (event: FocusOutsideEvent) => void | Event handler called when the focus moves outside of the DismissableLayer.
Can be prevented. | |
onInteractOutside | (event: PointerDownOutsideEvent | FocusOutsideEvent) => void | Event handler called when an interaction happens outside the DismissableLayer.
Specifically, when a pointerdown event happens outside or focus moves outside of it.
Can be prevented. | |
asChild | boolean |
<DrawerTitle>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean |
<DrawerDescription>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean |
Accessibility
Drawer is built on the same Dialog base as Modal: focus is trapped inside, Escape closes it, and focus returns to the trigger. Title and description parts give the panel its accessible name.
The close button has an accessible name, and the panel follows the page direction so it slides in from the expected edge.