DrawerPro
A bottom sheet you drag down to dismiss, with focus trap and safe-area padding.
$
pnpm dlx shadcn@latest add @lode/drawerLive preview
Opens a sheet you can drag down to close.
When to use
- Mobile-first sheets: filters, options, quick edits and confirmations.
When not to use
- Desktop forms with many fields: use a dialog or side sheet.
Installation
$
pnpm dlx shadcn@latest add @lode/drawerPro components need an API key and the registry in components.json. See CLI and API keys.
1Install the dependencies
npm install motion2Copy the source into your project
Usage
Import it from @/components/ui/drawer after installing.
example.tsx
import * as React from "react";
import { Button } from "@/components/ui/button";
import { Drawer } from "@/components/ui/drawer";
export function SizePicker() {
const [open, setOpen] = React.useState(false);
return (
<>
<Button onClick={() => setOpen(true)}>Choose a size</Button>
<Drawer open={open} onOpenChange={setOpen} title="Choose a size" footer={<Button onClick={() => setOpen(false)}>Done</Button>}>
…
</Drawer>
</>
);
}API reference
Drawer
A modal bottom sheet in a portal; drag the handle or header down to close.
open / onOpenChange
boolean / (open) => void
Controlled visibility.
title / description
ReactNode
Label and describe the dialog.
children / footer
ReactNode
Scrolling body and a pinned action row.
| Prop | Type | Default | Description |
|---|---|---|---|
| open / onOpenChange | boolean / (open) => void | – | Controlled visibility. |
| title / description | ReactNode | – | Label and describe the dialog. |
| children / footer | ReactNode | – | Scrolling body and a pinned action row. |
Keyboard interactions
| Keys | Action |
|---|---|
| Esc | Close |
| TaborShift+Tab | Cycle focus inside |
Accessibility
- A modal dialog, labelled and described, with a focus trap and focus return.
- Dragging is optional: Esc, the overlay and your buttons all close it.
Motion
- Slides up with a spring; drag down past 120px or flick to dismiss; it resists dragging upward.
Responsive behavior
- Full width on phones, 512px centered on larger screens; respects the home-indicator safe area.
Performance
- Nothing renders while closed.
Notes for AI
- Only the handle and header start drags, so the body can scroll normally.
This page as Markdown, for assistants and coding agents:
/components/drawer/markdownThe full library index for assistants is at /llms.txt.
Related
Lode·229 doc pages·llms.txt