Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Shadcn Drawer for React and Tailwind

A sliding panel with swipe support.

Installation

bunx --bun shadcn@latest add https://kit.dev/r/drawer.json

Anatomy

DrawerPositioner
DrawerPositioner
DrawerTitle
DrawerDescription
DrawerTrigger
DrawerOverlay
DrawerGrabber
└── DrawerGrabberIndicator
DrawerClose
DrawerSwipeArea

Usage

import { Button } from "@/components/ui/button";
import {
  Drawer,
  DrawerClose,
  DrawerContent,
  DrawerFooter,
  DrawerHeader,
  DrawerTrigger,
} from "@/components/ui/drawer";
<Drawer>
  <DrawerTrigger asChild>
    <Button variant="outline">Open</Button>
  </DrawerTrigger>
  <DrawerContent>
    <DrawerHeader
      description="Make changes to your account here. Swipe down to close."
      title="Edit Profile"
    />

    <DrawerFooter>
      <div className="mx-auto w-full max-w-xs">
        <DrawerClose asChild>
          <Button className="w-full" variant="outline">
            Close
          </Button>
        </DrawerClose>
      </div>
    </DrawerFooter>
  </DrawerContent>
</Drawer>

Accessibility

KeyDescription
Enter
Activate the focused control.
Space
Activate the focused control.

Demos

Close Button

Context

Controlled

Custom Spacing

Indent

Inset

Multiple Triggers

No Close Button

No Drag Area

Non Draggable

Non Modal

Root Provider

Scrollable

Snap Points

Swipe Directions

API Reference

Drawer

PropType
AttributeType

DrawerPositioner

div

PropType
AttributeType
CSS variableType

DrawerTitle

h2

PropType
AttributeType

DrawerDescription

div

PropType
AttributeType

DrawerTrigger

button

PropType
AttributeType
CSS variableType

DrawerOverlay

div

PropType
AttributeType
CSS variableType

DrawerGrabber

div

PropType
AttributeType
CSS variableType

DrawerGrabberIndicator

div

PropType
AttributeType
CSS variableType

DrawerClose

div

PropType
AttributeType
CSS variableType

DrawerProvider

div

PropType
AttributeType
CSS variableType

DrawerContent

div

PropType
AttributeType

DrawerHeader

div

PropType
AttributeType

DrawerBody

div

PropType
AttributeType
CSS variableType

DrawerFooter

div

PropType
AttributeType

DrawerRootProvider

PropType
AttributeType

useDrawer

PropType