Skip to content
Ballpoint

Dropdown Menu

A slip of choices: the highlighted one shaded in with the pen, ticks and dots drawn as you check them.

From shadcn/ui
Built on Base UI Menu

Installation

pnpm dlx shadcn@latest add @ballpoint/dropdown-menu

Usage

tsx
import { Button } from "@/components/ui/button"
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuLabel,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"

<DropdownMenu>
  <DropdownMenuTrigger render={<Button variant="outline" />}>Open</DropdownMenuTrigger>
  <DropdownMenuContent>
    <DropdownMenuLabel>Notebook</DropdownMenuLabel>
    <DropdownMenuItem>New page</DropdownMenuItem>
    <DropdownMenuSeparator />
    <DropdownMenuItem variant="destructive">Tear out page</DropdownMenuItem>
  </DropdownMenuContent>
</DropdownMenu>

Examples

An icon trigger for each row, with a destructive item set apart.

  • Shopping list
  • Meeting notes
  • Sketches

A profile as the trigger, with shortcuts and a red sign-out.

Items that tick and leave the menu open, so several can be changed in one go.

Title · Author · Pages

API reference

DropdownMenuItem variant
default "default"
"default" | "destructive"

Destructive rows are written, and shaded, in red pen.

inset
boolean

On items, labels and sub-triggers: lines them up with checkable items.

DropdownMenuCheckboxItem checked
boolean

Ticked when true; the tick draws in and pulls back out.

DropdownMenuContent side / align
default "bottom" / "start"
string

Where it opens against the trigger.

seed
string | number

On DropdownMenuContent: pins the drawing.

Every other prop goes to Base UI's Menu.

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.