Plinth

Context Menu

Right-click menu with the same item set as Dropdown Menu.

Right-click here

Install

npx shadcn@latest add https://plinth.dhrumilkherde.com/r/context-menu.json

Usage

import {
  ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem,
} from "@/components/ui/context-menu";

<ContextMenu>
  <ContextMenuTrigger>{/* the right-clickable surface */}</ContextMenuTrigger>
  <ContextMenuContent>
    <ContextMenuItem onClick={rename}>Rename</ContextMenuItem>
  </ContextMenuContent>
</ContextMenu>

Checkbox items, radio groups, submenus, labels, and groups work exactly like Dropdown Menu; the parts are prefixed ContextMenu*.

Accessibility

  • Opens at the pointer position on right-click, and via the keyboard context menu key / Shift+F10 on the trigger.
  • Same keyboard navigation as Dropdown Menu once open.
  • Anything reachable only by right-click should also exist somewhere visible; treat the context menu as a shortcut, not the only path.

On this page