Ballmac UI home

Context Menu

A right-click, long-press and Shift+F10 menu with submenus, checkbox and radio items, shortcut hints and a destructive style, built on Radix.

Q3 roadmap.pdf

Right-click, long-press or Shift+F10

Installation

$ pnpm dlx shadcn@latest add @ballmac/context-menu

Usage

import { ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuCheckboxItem, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuLabel, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubTrigger, ContextMenuSubContent } from "@/components/ballmac/context-menu"

The full example is in the Code tab above.

Examples

View options

API reference

<ContextMenuItem>

PropTypeDefault
inset

Indent the item so it lines up with items that show a check or icon.

boolean—
destructive

Style the item as a destructive action (delete, sign out).

boolean—

<ContextMenuLabel>

PropTypeDefault
inset

Indent the label to match inset items.

boolean—

<ContextMenuSubTrigger>

PropTypeDefault
inset

Indent the trigger to match inset items.

boolean—

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
Right-click / long-pressOpens the menu at the pointer
Shift+F10 / Menu keyOpens it from a focused trigger
ArrowUp / ArrowDownMoves between items
ArrowRight / ArrowLeftOpens and closes a submenu
EscapeCloses the menu

Use with AI

Shows actions at the pointer on right-click or long-press. Keyboard users open it with Shift+F10 or the Menu key on a focusable trigger. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Context Menu (@ballmac/context-menu) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • File, card and canvas actions
  • Secondary actions that also exist elsewhere
  • Desktop-style apps

Not for

  • The only way to reach an action; menus must be discoverable, so also offer a dropdown-menu button
  • Touch-first layouts without a visible trigger

Registry JSON: https://ui.ballmac.com/r/context-menu.json

Credits

Based on shadcn/ui Context Menu, adapted by Ballmac. Free to use in personal and commercial projects.