Drawer
Use Drawer for a temporary task panel that people can dismiss with a swipe, especially on touch screens.
Preview
Profile settings drawer
Open a profile panel with explanatory text and an explicit Close button, or dismiss it with a downward swipe.
Loading preview.
Installation
New to this Registry? Complete the base setup before continuing.
npx shadcn@latest add @neumorphism-ui/drawerInstall the shared base once, then add components and their dependencies with the CLI.
Profile settings drawer
npx shadcn@latest add @neumorphism-ui/drawer @neumorphism-ui/buttonUsage
Compose a trigger, content, header, title, and description within Drawer. Set swipeDirection for the intended edge and provide an explicit close action alongside gestures.
"use client";
import { Button } from "@/components/ui/button";
import { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger } from "@/components/ui/drawer";
export default function Example() {
return (
<Drawer swipeDirection="down">
<DrawerTrigger render={<Button />}>Quick settings</DrawerTrigger>
<DrawerContent>
<DrawerHeader>
<DrawerTitle>Quick settings</DrawerTitle>
<DrawerDescription>Adjust options without leaving this page.</DrawerDescription>
</DrawerHeader>
<DrawerFooter><DrawerClose render={<Button />}>Done</DrawerClose></DrawerFooter>
</DrawerContent>
</Drawer>
);
}API Reference
Uses Base UI Drawer gestures and focus management. Sheet is a fixed task panel; Drawer is better for temporary touch-first surfaces that users can swipe away or open from another edge.
| Component | Prop | Type | Default | Description |
|---|---|---|---|---|
Drawer | swipeDirection | "down" | "up" | "left" | "right" | "down" | Sets the opening, closing, and swipe direction. |
Drawer | open / onOpenChange | boolean / (open: boolean) => void | — | Controls the Drawer open state. |
Drawer | snapPoints | number[] | — | Configures intermediate resting points when needed. |
DrawerTrigger | render | ReactElement | — | Composes an existing Button or other element as the trigger. |
DrawerContent | className | string | (state) => string | — | Extends the panel styling while preserving direction and gesture behavior. |
Accessibility
- 01
Provide DrawerTitle and DrawerDescription so assistive technology can identify the opened panel.
- 02
A modal Drawer isolates background content and focus while open and should close with Escape.
- 03
Do not make swiping the only way to dismiss the Drawer; include an explicit DrawerClose control.