Drawer

A panel that slides in from an edge and can be swiped away.

Installation

pnpm dlx shadcn@latest add @cupertinoui/drawer

The first install also adds the macOS theme. See Installation to set up the registry.

Usage

import { Drawer, DrawerContent, DrawerHeader, DrawerTitle, DrawerTrigger } from "@/components/ui/drawer"

<Drawer>
  <DrawerTrigger render={<Button variant="secondary" />}>Open</DrawerTrigger>
  <DrawerContent>
    <DrawerHeader><DrawerTitle>Move Goal</DrawerTitle></DrawerHeader>
  </DrawerContent>
</Drawer>

API Reference

Every part forwards the props of the underlying Base UI Drawer part. The props below are the ones CupertinoUI adds or changes.

Drawer

PropTypeDescription
swipeDirection"down" | "up" | "left" | "right"
Default: "down"
The edge it slides from.
snapPoints(number | string)[]Heights it rests at.
showSwipeHandleboolean
Default: false
Shows the grab bar.
classNamestringExtra classes, merged with the component's own.