Design System
Overlays

Context menu

The right-click menu. Use it only as a shortcut to actions that are also reachable another way.

Purpose

A context menu opens on right-click (or long-press on touch) over a region — a table row, a canvas object. Nothing on screen advertises that it exists, so it is a power-user shortcut, never the primary path: every action in it must also be reachable through a visible control.

The visible equivalent is the Dropdown menu — same styling, same item anatomy, but opened from a button. If the actions have no other home, use that instead. Reserve the context menu for surfaces where right-click is an expected affordance: data tables, canvases, editor-like tools.

Row actions

Items, a group label, shortcut hints, dividers and one level of submenu — matching the story's claims-row example.

Right-click this area

ContextMenuShortcut is display only — it renders the hint and registers nothing. Bind the key handler yourself, and only show shortcuts that work.

Put a Kbd inside the slot rather than literal glyphs, so the hint reads ⌘O on a Mac and Ctrl+O on Windows.

Structure

Styling mirrors Dropdown menu, so the two are visually interchangeable.

PropertyValue
Surface--popover with 1px --border and --shadow-8
Radius--radius-lg menu · --radius-sm items
WidthMin 160px (min-w-[10rem]), 4px inner padding
Item14px text, 8px × 6px padding, focus --accent
Destructive item--destructive-text ink, focus --destructive-subtle fill
Group label12px / Inter 600, --muted-foreground
Sub-triggerItem styling plus a trailing 16px chevron, open --accent
PlacementAt the pointer; fade + zoom in and out

Best practices

Do

  • Duplicate every item somewhere visible — a row's overflow menu, a toolbar — right-click is never the only path.
  • Lead with a ContextMenuLabel naming the target ("Claim CLM-48213") so the menu confirms what was clicked.
  • Put destructive items last, after a separator, and mark them destructive.
  • Keep the trigger region generous — the whole row, not just its text.

Don't

  • Use it on general marketing or portal pages — nobody right-clicks there expecting app actions.
  • Nest more than one level of submenu.
  • Show a ContextMenuShortcut for a shortcut you have not bound.
  • Use it for choosing a value; that is Select.

Accessibility & keyboard

  • Opens on right-click, or on a 700ms long-press with touch and pen input.
  • Shift+F10 (or the dedicated menu key) fires the browser's contextmenu event, so it opens the menu only when focus is inside the trigger region. The trigger itself renders a non-focusable <span> — if the region contains no focusable element there is no keyboard way in, which is why every action must also exist on a visible control.
  • Keyboard, once open: Up/Down move between items; Right opens a submenu, Left closes it; Enter activates; Esc closes and returns focus.
  • Type-ahead jumps to the first item matching the typed letters.
  • Disabled items are skipped by arrow navigation and not activatable.

Props

Every part wraps its Radix Context Menu primitive and passes all of that primitive's props through; ContextMenuItem adds one prop of its own: destructive. There is no separate props interface to document.

Every ContextMenu part and prop in Storybook

On this page