Search documentation

Search components and pages

Drawer

A drawer component for React.

01

Installation

Add the drawer component with the shadcn CLI.

bash
npx shadcn@latest add https://swiss.ui.unsanity.ai/r/drawer.json
02

Usage

tsx
import { Drawer } from "@/components/ui/drawer"
03

Examples

Default

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

<Drawer>
  <DrawerTrigger asChild>
    <Button variant="outline">Open Drawer</Button>
  </DrawerTrigger>
  <DrawerContent>
    <DrawerHeader>
      <DrawerTitle>Are you sure?</DrawerTitle>
      <DrawerDescription>This action cannot be undone.</DrawerDescription>
    </DrawerHeader>
  </DrawerContent>
</Drawer>