Component guideEditable source

Drawer

A modal edge panel using Base UI drawer behavior.

Original component docs
On this page6 sectionsBack to top

Use Drawer for a compact task presented from a viewport edge. It is built on Base UI, not Vaul. Use Sheet for an edge dialog when drawer-specific interaction is unnecessary.

Live preview
Loading preview...

#Installation

Complete the base setup. For manual installation:

npx shadcn@latest add https://neobrutal-ui.andongmin.com/r/drawer.json

The Usage example additionally uses Button.

#Usage

import { Button } from "@/components/ui/button";
import {
  Drawer,
  DrawerTrigger,
  DrawerContent,
  DrawerHeader,
  DrawerTitle,
  DrawerDescription,
  DrawerFooter,
  DrawerClose,
} from "@/components/ui/drawer";

export default function TaskDrawer() {
  return (
    <Drawer swipeDirection="down">
      <DrawerTrigger render={<Button variant="outline" />}>Task details</DrawerTrigger>
      <DrawerContent>
        <DrawerHeader>
          <DrawerTitle>Task details</DrawerTitle>
          <DrawerDescription>Review this task before returning to the workspace.</DrawerDescription>
        </DrawerHeader>
        <div className="p-4">The draft is ready for review.</div>
        <DrawerFooter>
          <DrawerClose render={<Button variant="outline" />}>Close</DrawerClose>
        </DrawerFooter>
      </DrawerContent>
    </Drawer>
  );
}

#API reference

Prop / partPurposeDefault
Drawer.open / onOpenChangeControlled visibility and close cancellationUncontrolled
Drawer.swipeDirectionSwipe-to-dismiss edge: up, right, down, or leftdown
Drawer.snapPoints / snapPointNative snap positions and controlled active snap—
Drawer.modalFocus, scroll, and outside-interaction behaviortrue
DrawerTrigger.render / DrawerClose.renderButton compositionPrimitive elements
DrawerTitle / DrawerDescriptionModal name and explanation—
DrawerContentStyled Base UI viewport, popup, and content—

#Accessibility

Provide a title, useful description, and an explicit close action rather than relying only on a drag gesture. Test keyboard focus, Escape, and focus restoration. Long content must scroll within reachable bounds, and the on-screen keyboard must not hide the only action. Do not show successful persistence merely because the drawer closed.

#Examples

#Scrollable content

Loading preview...