Skip to content
Ballpoint

Context Menu

The dropdown menu's slip of paper, opened where you right-click or long-press.

From shadcn/ui
Built on Base UI Context Menu
Right-click here

Installation

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

Usage

tsx
import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger } from "@/components/ui/context-menu"

<ContextMenu>
  <ContextMenuTrigger>Right-click here</ContextMenuTrigger>
  <ContextMenuContent>
    <ContextMenuItem>Back</ContextMenuItem>
    <ContextMenuItem>Reload</ContextMenuItem>
  </ContextMenuContent>
</ContextMenu>

Examples

On rows

A menu per row, with icons and a destructive last item.

Letter to Ada.txt
Margin notes.md
Field sketches.png

API reference

ContextMenuItem variant
default "default"
"default" | "destructive"

A destructive item is shaded in red pen.

ContextMenuItem inset
default false
boolean

Indents the item to line up with items that have a check or dot.

ContextMenuCheckboxItem / RadioItem
—

Ticked and dotted choices, drawn in as they are chosen.

seed
string | number

Pins the drawing.

Every other prop goes to Base UI's Context 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.