- Accordion
- Action Bar
- Alert Dialog
- Alert
- Announcement
- Aspect Ratio
- Autocomplete
- Avatar
- Badge
- Bottom Navigation
- Breadcrumb
- Button Group
- Button
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Circular Progress
- Circular Slider
- Clipboard
- Collapsible
- Color Picker
- Combobox
- Command
- Context Menu
- Data List
- Date Picker
- Dialog
- Drawer
- Editable
- Field
- File Upload
- Float
- Floating Panel
- Frame
- Hint
- Hover Card
- Image Cropper
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Link Overlay
- Listbox
- Marquee
- Menu
- Native Select
- Number Input
- Pagination
- Popover
- Progress
- Prose
- QR Code
- Radio Group
- Rating
- Resizable
- Scroll Area
- Segment Group
- Select
- Separator
- Sheet
- Sidebar
- Signature Pad
- Skeleton
- Skip Nav
- Slider
- Spinner
- Status
- Steps
- Switch
- Table
- Tabs
- Textarea
- Timer
- Toast
- Toggle Group
- Toggle Tooltip
- Toggle
- Tooltip
- Tour
- Tree View
Edit Profile
Installation
pnpm dlx shadcn@latest add https://shark.vini.one/r/drawer.json
Usage
import { Drawer, DrawerTrigger, DrawerContent, DrawerContentInner, DrawerHeader, DrawerTitle, DrawerDescription, DrawerBody, DrawerFooter, DrawerClose, } from "@/components/ui/drawer";
<Drawer> <DrawerTrigger /> <DrawerContent> <DrawerContentInner> <DrawerHeader> <DrawerTitle /> <DrawerDescription /> </DrawerHeader> <DrawerBody> {/** your content here */} </DrawerBody> </DrawerContentInner> <DrawerFooter> <DrawerContentInner> <DrawerClose /> </DrawerContentInner> </DrawerFooter> </DrawerContent> </Drawer>
Examples
Container
Use <DrawerContentInner /> to constrain drawer content width to max-w-sm.
Container
Inset Variant
Use variant="inset" on <DrawerContent /> so the drawer appears as a floating card rather than edge-to-edge.
Inset drawer
Swipe Directions
Control which direction the drawer slides and swipes using swipeDirection on the root.
Bottom Drawer
Swipe down to close this drawer.
Top Drawer
Swipe up to close this drawer.
Start Drawer
Swipe left to close this drawer.
End Drawer
Swipe right to close this drawer.
Snap Points
Use snapPoints to allow the drawer to snap to multiple heights.
Snap Points
This drawer has multiple snap points. Try dragging the handle to quarter, half, or full height.
Custom spacing
Use [--space:--spacing("value")] and [--bleed:…] on <DrawerContent /> to tune padding and bottom bleed (defaults --spacing(4) and 3rem).
Custom spacing
API Reference
Drawer
Root element of the drawer.
| Prop | Type | Default |
|---|---|---|
open | boolean | - |
defaultOpen | boolean | false |
onOpenChange | ({ open }: OpenChangeDetails) => void | - |
swipeDirection | "up" | "down" | "left" | "right" | "down" |
snapPoints | (number | string)[] | [1] |
defaultSnapPoint | number | string | null | 1 |
snapToSequentialPoints | boolean | false |
closeThreshold | number | 0.25 |
swipeVelocityThreshold | number | 700 |
preventDragOnScroll | boolean | true |
modal | boolean | true |
closeOnEscape | boolean | true |
closeOnInteractOutside | boolean | true |
className | string | - |
DrawerTrigger
Opens the drawer on click. Use asChild for custom trigger elements.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | false |
className | string | - |
DrawerContent
Holds the drawer panel. Supports swipe-to-close; direction inherited from root swipeDirection.
| Prop | Type | Default |
|---|---|---|
variant | "default" | "inset" | "default" |
className | string | - |
| Attribute | Default |
|---|---|
--bleed | 3rem |
--space | --spacing(4) |
DrawerContentInner
Wrapper that constrains content to max-w-sm and centers it. Use to wrap the main body (header + body) or footer actions. When used inside DrawerFooter, inherits flex-col-reverse and gap-2 for button layout.
| Prop | Type | Default |
|---|---|---|
className | string | - |
DrawerHeader
Header area for title and description. Accepts props or children.
| Prop | Type | Default |
|---|---|---|
title | string | - |
description | string | - |
className | string | - |
DrawerTitle
Accessible title for the drawer. Announced to screen readers.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | false |
className | string | - |
DrawerDescription
Accessible description for the drawer. Announced to screen readers.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | false |
className | string | - |
DrawerBody
Scrollable body content. Uses ScrollArea for overflow. Supports scrollFade for gradient edges.
| Prop | Type | Default |
|---|---|---|
scrollFade | boolean | false |
className | string | - |
DrawerFooter
Footer area for action buttons.
| Prop | Type | Default |
|---|---|---|
className | string | - |
DrawerClose
Closes the drawer on click. Use asChild for custom close elements.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | false |
className | string | - |
For a complete list of props, see the Ark UI documentation.