Skip to content
Design System
GitHub

Context menu

v0.21.0Beta

Actions on an item by right-click or long press, styled exactly like the dropdown menu; a shortcut to actions that are also on a visible control.

Patrolling · Warehouse 2

Paused · Warehouse 2

Offline · Loading bay

Context menu default

Install
npx shadcn add @syncrobotic/context-menu

Also installs: radix-ui, lucide-react, @syncrobotic/cn

Overview

The menu a right-click or a long press opens on an item, in the dropdown menu's look. A shortcut to actions that are also on a visible control.

When to use

  • Rows of a robot or mission list, cards, nodes on a map or a tree: the same actions as the row's ⋯ menu, where people expect a right-click.

Use something else

  • The only way to an action: never. Add a ⋯ button with a Dropdown menu (same items), a toolbar button, or put it on the detail page.
  • One obvious action on the item: a Button on it.

More examples

States and real uses. Each example is also a Storybook story and a visual regression test.

24 events this week

Grouped by robot; showing Robot, Site, Battery. Right-click here for the same options.

Context menu with options

Usage rules

  • A shortcut, never the only way: every action in it is also on a visible control (a ⋯ button with the same DropdownMenu, a toolbar, the detail page). Nobody can see that a context menu exists, and many tablets have no right-click.
  • Touch: pressing and holding for 700 ms opens it (Radix does this). Keyboard: Shift+F10 or the Menu key on anything focused inside the trigger area; make the area focusable only if nothing in it is.
  • Same items, same order as the visible menu. Destructive items go last, after a separator, in danger text.
  • Submenus one level deep and short; ticks for options that switch on and off, a radio group for one of several.
  • Leave the browser's own menu on text people copy and on links: put the trigger on the row or card, not on a field.

Changelog

  • 0.21.02026-11-20First release: Radix ContextMenu in the dropdown menu's look (items, checkbox and radio items, labels, separators, shortcuts, submenus; keyboard ring only in keyboard use). Long press opens it on touch.

How to upgrade