Command Palette

Search for a command to run...

Drawer

shadcn/ui

A drawer component built on top of Vaul.

import {	Drawer,	DrawerClose,	DrawerContent,	DrawerDescription,	DrawerFooter,	DrawerHeader,	DrawerTitle,	DrawerTrigger,} from "@/registry/optics/drawer";import { Button } from "@/registry/optics/button";<Drawer>	<DrawerTrigger asChild>		<Button variant="raised">Open Drawer</Button>	</DrawerTrigger>	<DrawerContent>		<DrawerHeader>			<DrawerTitle>Are you absolutely sure?</DrawerTitle>			<DrawerDescription>This action cannot be undone.</DrawerDescription>		</DrawerHeader>		<div className="p-4 pb-0">			<div className="space-y-4">				<div className="grid gap-2">					<Label htmlFor="email">Email</Label>					<Input id="email" placeholder="name@example.com" />				</div>			</div>		</div>		<DrawerFooter>			<Button variant="raised">Submit</Button>			<DrawerClose asChild>				<Button variant="raised">Cancel</Button>			</DrawerClose>		</DrawerFooter>	</DrawerContent></Drawer>

Installation

pnpm dlx shadcn@latest add https://optics.agusmayol.com.ar/r/drawer.json

Props

<Drawer />
Name
Type
open
boolean
defaultOpen
boolean
onOpenChange
(open: boolean) => void
direction
"top" | "bottom" | "left" | "right"
dismissible
boolean (default: true)
snapPoints
number[]
activeSnapPoint
number
setActiveSnapPoint
(snapPoint: number) => void

<DrawerTrigger />
Name
Type
asChild
boolean
<DrawerContent />
Name
Type
className
string
onEscapeKeyDown
(event: KeyboardEvent) => void
onPointerDownOutside
(event: PointerEvent) => void
<DrawerHeader />
Name
Type
className
string
<DrawerFooter />
Name
Type
className
string
<DrawerTitle />
Name
Type
className
string
<DrawerDescription />
Name
Type
className
string
<DrawerOverlay />
Name
Type
className
string
<DrawerClose />
Name
Type
asChild
boolean