Installation
npx logic2b@next add drawerUsage
import {
Drawer,
DrawerClose,
DrawerContent,
DrawerDescription,
DrawerFooter,
DrawerHeader,
DrawerTitle,
DrawerTrigger,
} from "@/components/ui/drawer"
<Drawer>
<DrawerTrigger>Open</DrawerTrigger>
<DrawerContent>
<DrawerHeader>
<DrawerTitle>Edit profile</DrawerTitle>
<DrawerDescription>Make changes to your profile here.</DrawerDescription>
</DrawerHeader>
<DrawerFooter>
<DrawerClose>Cancel</DrawerClose>
</DrawerFooter>
</DrawerContent>
</Drawer>
Built on vaul. Unlike sheet, which is a plain Radix Dialog sliding in from an edge, drawer supports drag-to-dismiss and snap points — better suited for mobile bottom sheets.
Examples
Right Direction
Scrollable Content
Accessibility
- Extends Radix Dialog via vaul, so focus is trapped while open and restored to the trigger on close.
- Provide a
DrawerTitle(and ideally aDrawerDescription) so screen readers announce the drawer — vaul wires them up as the accessible name/description. - Dismissable with
Escape, an overlay click, or a drag/swipe toward the edge it slides in from.
Live playground
Edit the component props and inspect the exact JSX before copying it. The preview loads only when this section enters the viewport.
Generated JSX
<Drawer
direction="bottom"
>
<DrawerTrigger
className="rounded-md border px-4 py-2 text-sm font-medium"
>Open release drawer</DrawerTrigger>
<DrawerContent>
<DrawerHeader>
<DrawerTitle>Release checklist</DrawerTitle>
<DrawerDescription>Review each quality gate before publishing.</DrawerDescription>
</DrawerHeader>
<div
className="px-4 pb-4 text-sm"
>Tests · accessibility · visual baselines</div>
<DrawerFooter>
<DrawerClose
className="rounded-md border px-4 py-2 text-sm font-medium"
>Done</DrawerClose>
</DrawerFooter>
</DrawerContent>
</Drawer>API reference
Generated from the public TypeScript exports in src/ui/drawer.tsx.
Drawer
ComponentProps: React.ComponentProps<typeof DrawerPrimitive.Root>DrawerPortal
ComponentProps: React.ComponentProps<typeof DrawerPrimitive.Portal>DrawerOverlay
ComponentProps: React.ComponentProps<typeof DrawerPrimitive.Overlay>DrawerTrigger
ComponentProps: React.ComponentProps<typeof DrawerPrimitive.Trigger>DrawerClose
ComponentProps: React.ComponentProps<typeof DrawerPrimitive.Close>DrawerContent
ComponentProps: React.ComponentProps<typeof DrawerPrimitive.Content>DrawerHeader
ComponentProps: React.ComponentProps<"div">DrawerFooter
ComponentProps: React.ComponentProps<"div">DrawerTitle
ComponentProps: React.ComponentProps<typeof DrawerPrimitive.Title>DrawerDescription
ComponentProps: React.ComponentProps<typeof DrawerPrimitive.Description>Accessibility contract
Machine-readable behavior and consumer responsibilities for drawer.
- Support
- Primitive-managed
- Pattern
- modal dialog
- Vaul Dialog
| Keys | Behavior |
|---|---|
| Escape | Close the open surface and restore focus. |
| Tab Shift+Tab | Cycle focus inside the drawer. |
Built-in semantics
- Uses dialog title/description primitives and modal focus management.
Consumer responsibilities
- Provide DrawerTitle, an accessible close control and a non-drag dismissal path.