Skip to content
Drivn logoDrivn

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
openbooleanControlled open state. Omit for uncontrolled mode.
onOpenChange(open: boolean) => voidCallback fired when the drawer open state changes
childrenReactNodeDrawer sub-components (Trigger, Content, Close, Header, Footer)

Drawer.Content

PropTypeDefaultDescription
side'left' | 'right' | 'top' | 'bottom''right'Which edge the drawer slides in from
classNamestringAdditional CSS classes for the drawer panel
childrenReactNodeContent rendered inside the drawer

Drawer.Header

PropTypeDefaultDescription
titlestringHeading text displayed in the header
descriptionstringOptional description text below the title
classNamestringAdditional CSS classes for the header

Drawer.Footer

PropTypeDefaultDescription
childrenReactNodeFooter content, typically action buttons
classNamestringAdditional CSS classes for the footer