Skip to content
Protocore Design Systemv1.6.9

/// Overlay

ContextMenu

A right-click (or long-press) menu opened at the pointer — the same item vocabulary as DropdownMenu, bound to a surface.

import { ContextMenu } from "@protocore/pds";
View as Markdown

Basics

ContextMenu.Trigger is the surface; right-clicking (or long-pressing on touch) opens the menu at the pointer. Items support startIcon, endHint, and tone="danger" — same API as DropdownMenu.

Right-click this ledger row

Toggles & submenus

The full menu vocabulary is available: Label, CheckboxItem, Separator, and a nested Sub / SubTrigger / SubContent with a RadioGroup inside.

Right-click the log viewer

When to use it

A ContextMenu attaches actions to a surface or object — a table row, a canvas node, a file tile — surfaced by the platform's contextual gesture (right-click, long-press). It's a power-user affordance: the same actions should always be reachable another way, because context menus are undiscoverable on their own.

It shares its entire part vocabulary with [DropdownMenu](/overlay/dropdown-menu) — the only difference is the trigger. Choose ContextMenu when the natural gesture is right-clicking the thing itself; choose DropdownMenu when there's a visible button (a "⋯" overflow) to click. Never make a context menu the *only* path to an action, and don't override the browser's native menu on plain text or links where users expect it.

Usage

Do

  • Attach it to a concrete object — a row, a node, a tile.
  • Mirror every context action in a visible control too (an overflow menu).
  • Reuse the DropdownMenu item vocabulary for a consistent feel.
  • Keep the list short; context menus are for the object's top actions.

Don't

  • Make a context menu the only way to reach an action.
  • Override the native menu on ordinary selectable text or links.
  • Pack unrelated global commands in — those belong in a menu or command palette.
  • Nest deep submenu trees that are hard to reach at the pointer.

Accessibility

KeysAction
Shift + F10 / Menu keyOpens the context menu from the keyboard on the focused trigger.
↑ / ↓Moves focus between items (roving tabindex).
→ / ←Opens / closes a submenu.
Home / EndJumps to the first / last item.
A–ZTypeahead to the next matching item.
EscCloses the menu and returns focus to the trigger.
  • Opens on contextmenu (right-click), long-press on touch, and Shift+F10 / the Menu key.
  • Same menu roles as DropdownMenu; focus is trapped while open and restored on close.
  • Because it's gesture-triggered and undiscoverable, always provide an equivalent visible control.
  • Checkbox and radio items announce their state to assistive tech.

ContextMenu.Content props

PropTypeDefaultDescription
asChildboolean
classNamestring
styleCSSProperties

ContextMenu.Item props

PropTypeDefaultDescription
asChildboolean
classNamestring
endHintReactNodeOptional trailing hint (shortcut, chevron).
startIconReactNodeOptional leading icon slot.
styleCSSProperties
toneenumneutralSet `"danger"` to render a destructive item (danger-fg text).

Related

  • DropdownMenuA menu of actions opened from a button — items, checkboxes, radio groups, and nested submenus with full keyboard navigation.
  • PopoverA non-modal floating panel anchored to a trigger — for secondary controls, filters, and rich detail that shouldn't block the page.
  • DataTableThe server-driven console workhorse — TanStack v8 in manual mode with sorting, pagination, selection, and five body states.
  • ListingRowA scannable list row — mono title, mono meta columns, and a trailing outbound arrow; hover dims to 0.6.