Skip to content
Drivn

Drawer

Slide-in panel with overlay, side positioning, and structured header/footer layout.

Preview

Edit Profile

Make changes to your profile.

Installation

npx drivn add drawer

Usage

1import { Drawer } from "@/components/ui/drawer"
2import { Button } from "@/components/ui/button"
3import { Input } from "@/components/ui/input"
4import { Label } from "@/components/ui/label"
5
6export default function Page() {
7 return (
8 <Drawer>
9 <Drawer.Trigger>Edit Profile</Drawer.Trigger>
10 <Drawer.Content>
11 <Drawer.Close />
12 <Drawer.Header
13 title="Edit Profile"
14 description="Make changes to your profile."
15 />
16 <div className="flex-1 overflow-y-auto p-6">
17 <div className="flex flex-col gap-4">
18 <div className="flex flex-col gap-2">
19 <Label htmlFor="name">Name</Label>
20 <Input id="name" placeholder="John Doe" />
21 </div>
22 <div className="flex flex-col gap-2">
23 <Label htmlFor="email">Email</Label>
24 <Input id="email" placeholder="john@example.com" />
25 </div>
26 </div>
27 </div>
28 <Drawer.Footer>
29 <Button>Save Changes</Button>
30 </Drawer.Footer>
31 </Drawer.Content>
32 </Drawer>
33 )
34}

Sides

Slides from right

Slides from left

Slides from top

Slides from bottom

API Reference

Drawer

PropTypeDefaultDescription
openboolean—Controlled open state. Omit for uncontrolled mode.
onOpenChange(open: boolean) => void—Callback fired when the drawer open state changes
childrenReactNode—Drawer sub-components (Trigger, Content, Close, Header, Footer)

Drawer.Content

PropTypeDefaultDescription
side'left' | 'right' | 'top' | 'bottom''right'Which edge the drawer slides in from
classNamestring—Additional CSS classes for the drawer panel
childrenReactNode—Content rendered inside the drawer

Drawer.Header

PropTypeDefaultDescription
titlestring—Heading text displayed in the header
descriptionstring—Optional description text below the title
classNamestring—Additional CSS classes for the header

Drawer.Footer

PropTypeDefaultDescription
childrenReactNode—Footer content, typically action buttons
classNamestring—Additional CSS classes for the footer