components
/components/ui/drawer.tsx
/components/ui/drawer.tsx
Drawer
Slide-in panel for additional content or navigation
Installation
Usage
Imports
import {
Drawer,
DrawerBody,
DrawerClose,
DrawerContent,
DrawerDescription,
DrawerFooter,
DrawerHeader,
DrawerTitle,
DrawerTrigger,
} from "@/components/ui/drawer"Code
<Drawer variant="default" direction="left" handle={false} backdrop="overlay">
<DrawerTrigger>
<Button variant="outline" color="neutral">
<ChevronLeft size={20} /> Left
</Button>
</DrawerTrigger>
<DrawerContent>
<DrawerHeader>
<DrawerTitle>This is a drawer header</DrawerTitle>
<DrawerDescription>
This is a drawer description message.
</DrawerDescription>
</DrawerHeader>
<DrawerBody>
<p>This is the main content of the drawer.</p>
</DrawerBody>
<DrawerFooter>
<DrawerClose>
<Button variant="outline" color="neutral">
Close Drawer
</Button>
</DrawerClose>
<Button>Submit Action</Button>
</DrawerFooter>
</DrawerContent>
</Drawer>Examples
Variant
Position
With Handle
Backdrop
Props
<Drawer>
| Name | Default | Values |
|---|---|---|
| variant* | default | defaultfloatrounded |
| direction* | right | leftrighttopbottom |
| handle | false | boolean |
| backdrop* | overlay | overlayblurnone |
<DrawerTrigger>
| Name | Default | Values |
|---|---|---|
| asChild* | true | boolean |
<DrawerClose>
| Name | Default | Values |
|---|---|---|
| asChild* | true | boolean |
<DrawerFooter>
| Name | Default | Values |
|---|---|---|
| External Reference | - | - |