Drawer
A drawer component that slides in from the edge of the screen.
Preview
import { Button } from "@/components/ui/Button";
import {
Drawer,
DrawerClose,
DrawerContent,
DrawerDescription,
DrawerFooter,
DrawerHeader,
DrawerTitle,
DrawerTrigger,
} from "@/components/ui/Drawer";
export function DrawerDemo() {
return (
<Drawer>
<DrawerTrigger asChild>
<Button variant="outline">Open Drawer</Button>
</DrawerTrigger>
<DrawerContent>
<div className="mx-auto w-full max-w-sm">
<DrawerHeader>
<DrawerTitle>Move Goal</DrawerTitle>
<DrawerDescription>Set your daily activity goal.</DrawerDescription>
</DrawerHeader>
<div className="p-1.5 pb-0">
<div className="flex items-center justify-center space-x-2">
<div className="flex-1 text-center">
<div className="text-7xl font-bold tracking-tighter">350</div>
<div className="text-[0.70rem] uppercase text-muted-foreground">
Calories/day
</div>
</div>
</div>
</div>
<DrawerFooter>
<Button>Submit</Button>
<DrawerClose asChild>
<Button variant="outline">Cancel</Button>
</DrawerClose>
</DrawerFooter>
</div>
</DrawerContent>
</Drawer>
);
}Installation
Make sure that namespace is set in your component.json file. Namespace docs: Learn more about namespaces
pnpm dlx shadcn@latest add @aura/drawerProps
Drawer
| Prop | Type | Default |
|---|---|---|
| All props from | DrawerPrimitive.Root | - |
DrawerPortal
| Prop | Type | Default |
|---|---|---|
| All props from | DrawerPrimitive.Portal | - |
DrawerOverlay
| Prop | Type | Default |
|---|---|---|
| All props from | DrawerPrimitive.Overlay | - |
DrawerTrigger
| Prop | Type | Default |
|---|---|---|
| All props from | DrawerPrimitive.Trigger | - |
DrawerClose
| Prop | Type | Default |
|---|---|---|
| All props from | DrawerPrimitive.Close | - |
DrawerContent
| Prop | Type | Default |
|---|---|---|
| All props from | DrawerPrimitive.Content | - |
DrawerHeader
| Prop | Type | Default |
|---|---|---|
| All props from | "div" | - |
DrawerFooter
| Prop | Type | Default |
|---|---|---|
| All props from | "div" | - |
DrawerTitle
| Prop | Type | Default |
|---|---|---|
| All props from | DrawerPrimitive.Title | - |
DrawerDescription
| Prop | Type | Default |
|---|---|---|
| All props from | DrawerPrimitive.Description | - |