Context menu

A React component in Beamline's Overlays category.

Actions for an object on right-click, long-press, Shift+F10 or the menu key, opened at the pointer, with the same rows as the dropdown menu.

Use it for

  • Right-click actions on an object: a file, a row, a canvas node.

Not for

  • The only way to reach an action: always mirror it in a visible menu or button (dropdown-menu).

Anatomy

  • target (your element, focusable)
  • surface
  • highlight plate
  • rows: item, check item, radio item, heading, separator, submenu

Variants

  • tone: default, danger

States

  • closed
  • open
  • item highlighted
  • item disabled
  • check on/off
  • submenu open

Keyboard

  • Shift+F10 or the menu key on the focused target opens
  • ↑ ↓ move, wrapping
  • → opens a submenu, ← closes it
  • type a letter to jump
  • Escape closes and returns focus

Motion

Same surface and gliding highlight as the dropdown menu. Opens out of its trigger (for a context menu, out of the point that was pressed) (_shared/overlay.module.css, source morph): the layer starts as the trigger's own box, offset onto it, and grows; the side next to the trigger is there at once so the nearest rows read within the ruled 90 ms, the far side settles by ~200 ms, content fades in over 90 ms; it closes back into the trigger in 180 ms. Until it has grown the press that opened it cannot land on a row. Reduced motion: it appears.

Props

PropTypeDefaultDescription
labelstring—
itemsMenuItem[] (shared with dropdown-menu and menubar)—
childrenReactElement—
disabledboolean—
onOpenChange(open: boolean) => void—
classNamesMenuClassNames—
style / refCSSProperties / native Ref—Root styles; ref targets native popup div.

Dependencies

@radix-ui/react-context-menu, lucide-react

Import

import { ContextMenu } from "@/components/context-menu/context-menu";

Get it

Context menu is part of Beamline: 190 React components and screens your coding agent (Claude Code, Codex, Cursor or any MCP client) installs into your app through Beamline's MCP server, as a ready-built package or as plain React source you can change. $49 one payment (regular $200), no subscription, a year of updates, one licence for your whole team. Get Beamline · Connect your agent

More in Overlays

  • Alert Dialog: A blocking confirmation that must be answered: the scrim does not dismiss it, focus starts on the safe choice, and an async action keeps it open until…
  • Bottom sheet: A phone panel that rests at a peek and follows the finger to full height; a flick down closes it, and the handle works from the keyboard.
  • Command menu: Search-first list of every action: ranked matching, groups, keycap shortcuts and nested pages; inline as CommandPalette or in a ⌘K dialog as CommandMenu.
  • Dialog: A focused task over the page (create, invite, rename) with a title, body and footer; focus moves in, is trapped and returns on close.
  • Dropdown menu: A list of actions behind a trigger, with shortcuts, check items, headings and submenus; one highlight glides under the pointer and jumps with the keyboard.
  • Hover card: A preview of a person, link or record on hover or keyboard focus, without leaving the page; HoverCardProfile is the standard person preview.
  • Popover: A small surface anchored to a trigger for a short form, a filter or an explanation; focus moves in and returns on close.
  • Sheet: A panel that slides in from an edge with the page still visible behind it: header and footer stay put while the body scrolls.
  • Toast: Short results of an action stacked at an edge: point at the stack to fan it out and pause the timers; undo or retry in place; Alt+T, Escape and a swipe…
  • Tooltip: Short supporting text for a control: opens after a moment on hover and at once on keyboard focus; inside a toolbar group the next one opens instantly.