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/drawer

Install 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/button
Registry JSON

Usage

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.

ComponentPropTypeDefaultDescription
DrawerswipeDirection"down" | "up" | "left" | "right""down"Sets the opening, closing, and swipe direction.
Draweropen / onOpenChangeboolean / (open: boolean) => void—Controls the Drawer open state.
DrawersnapPointsnumber[]—Configures intermediate resting points when needed.
DrawerTriggerrenderReactElement—Composes an existing Button or other element as the trigger.
DrawerContentclassNamestring | (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.