Make your AI a shadcn expert

Shadcn Drawer

React drawer for mobile sheets and side panels. Built with TypeScript and Tailwind CSS for Next.js using Base UI — swipe to dismiss, four sides, snap points.

The shadcn drawer is a panel that slides in from an edge. Drag the handle, swipe it closed, or tap the overlay. Use it for mobile action sheets, filters, and short forms that should not cover the whole viewport.

Scroll to load preview...

Looking for a neobrutalism version for shadcn?

Same drawer, thicker borders. The NeoBrutalism drawer is the kit if you want that look.

Usage

import {
  Drawer,
  DrawerClose,
  DrawerContent,
  DrawerDescription,
  DrawerFooter,
  DrawerHeader,
  DrawerTitle,
  DrawerTrigger,
} from "@/components/ui/drawer"
<Drawer>
  <DrawerTrigger>Open</DrawerTrigger>
  <DrawerContent>
    <DrawerHeader>
      <DrawerTitle>Edit profile</DrawerTitle>
      <DrawerDescription>This action cannot be undone.</DrawerDescription>
    </DrawerHeader>
    <DrawerFooter>
      <Button>Submit</Button>
      <DrawerClose>
        <Button variant="outline">Cancel</Button>
      </DrawerClose>
    </DrawerFooter>
  </DrawerContent>
</Drawer>

direction is top, right, bottom, or left. Default is bottom — that is the only side that shows the grab handle.

Composition

DrawerTrigger
DrawerTitle
DrawerDescription

Scrollable Content

Keep the header and footer pinned. Put overflow-y-auto on the middle region, not on DrawerContent.

Scroll to load preview...

Sides

direction on Drawer. Bottom and top cap at 50vh here so the page behind still shows.

Scroll to load preview...

Responsive Dialog

Same form, two shells. Dialog from md up, drawer on small screens. Share open so the trigger does not remount.

Scroll to load preview...

Nested

A drawer opening another drawer. Dismiss the inner one first.

Scroll to load preview...

Non-modal

The page stays interactive. Use it when they still need the content behind.

Scroll to load preview...

Snap Points

Stop at 30%, 50%, 90%. They drag between stops.

Scroll to load preview...

Swipe Handle

A visible grabber at the top. Mobile expects it.

Scroll to load preview...

RTL

Wrap with DirectionProvider and dir="rtl". Copy, numbers, and the chart axis follow the reading direction.

Scroll to load preview...

API

Prop

Type

DrawerTrigger

Prop

Type

DrawerClose takes render the same way. DrawerTitle is announced when the panel opens.

Keyboard

KeyAction
Space / EnterOpen from the trigger, or fire the focused button
EscapeClose and return focus to the trigger
Tab / Shift + TabCycle controls inside the drawer

Swipe the handle or the overlay to dismiss. dismissible={false} turns both the swipe and Escape off.

Notes

Scroll the inner region

overflow-y-auto on DrawerContent steals the drag gesture. Scroll a child. Leave the header and footer outside that scroller so actions stay on screen.

On a laptop, pair this with a Dialog. A bottom sheet on a wide viewport is a small strip of form.

With other components

Questions

Was this page helpful?

Sign in to leave feedback.