Skip to content
Ballpoint

Drawer

A sheet of paper dragged in from an edge of the screen and flicked away again.

From shadcn/ui
Built on Base UI Drawer

Installation

pnpm dlx shadcn@latest add @ballpoint/drawer

Usage

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

<Drawer>
  <DrawerTrigger>Open</DrawerTrigger>
  <DrawerContent>
    <DrawerHeader>
      <DrawerTitle>Move goal</DrawerTitle>
      <DrawerDescription>Set your daily goal.</DrawerDescription>
    </DrawerHeader>
  </DrawerContent>
</Drawer>

Examples

Directions

A drawer from each edge of the screen.

With a form

A side drawer for something longer than a confirmation.

API reference

direction
default "bottom"
"top" | "right" | "bottom" | "left"

The edge it comes from, and the way you drag it to put it away.

open / defaultOpen
default false
boolean

Open or closed, controlled or not.

snapPoints
(number | string)[]

Heights a bottom drawer rests at. Passed through to Base UI.

DrawerContent seed
string | number

Pins the drawing.

Every other prop goes to Base UI's Drawer.

Pen settings

The drawing also takes draw, roughness, passes, radius, corners, shadow, weight and speed, as props or from the nearest InkProvider. What each one does.