Skip to content
HyperDesign System

Context menu

The right-click menu for an area or an object, opened at the pointer. Same skin and keyboard model as Dropdown menu. Source: src/components/ui/context-menu.tsx.

Default

Right-click the area, long-press it on touch, or focus it and press Shift+F10. Inside, arrows move, → opens the submenu, Esc closes and focus goes back to the area.

Right-click hereLong-press on touch · Shift+F10 or the Menu key when focused
last: nothing yet · grid on · rulers off · zoom fit

Per row

One menu per object. The open row keeps a tint fill (data-state=open on the trigger) so it is clear what the menu acts on, and the label repeats its name.

  • Launch brief.md
  • Pricing research.pdf
  • Interview notes.md

Motion and layering

Shares DropdownMenu's surface and motion strings; keyframes, so not interruptible.

Context menu motion and layering
ValueTokenUsage
pointerOpens at the cursor (or the long-press point), not against an edge of the trigger.
140msFade and scale from 95%, as on DropdownMenu.
90msFade and scale out.
50The brand ladder (--z-dropdown 100) is defined but not wired in yet.
max-hLong menus scroll inside the viewport.

Props

Context menu parts and props
Part / propTypeDefaultDescription
ContextMenuRadix ContextMenu.Root—onOpenChange, modal. There is no open prop: the pointer opens it.
ContextMenuTriggerRadix ContextMenu.Trigger—The area that listens for contextmenu and long-press. disabled. Gets data-state=open.
ContextMenuContentRadix ContextMenu.Content—Portals itself. loop, alignOffset, collisionPadding.
ContextMenuItemRadix ContextMenu.Item—onSelect, disabled, textValue.
variant"default" | "destructive""default"Destructive turns text, icon and focus fill red.
insetbooleanfalse32px left padding. Also on Label and SubTrigger.
ContextMenuCheckboxItemRadix CheckboxItem—checked, onCheckedChange. Always has the check gutter (no indicator prop, unlike the dropdown).
ContextMenuRadioGroup, RadioItemRadix—value, onValueChange / value. Always has the dot gutter.
ContextMenuLabelRadix Label—Heading row; inset available.
ContextMenuGroup, SeparatorRadix—Grouping and a hairline that bleeds to the edges.
ContextMenuShortcutComponentProps<"span">—Right-aligned slot for text or Kbd. Display only.
ContextMenuSub, SubTrigger, SubContentRadix—Nested menu. SubContent is not portalled.
ContextMenuPortalRadix Portal—Exported; Content already portals.

Best practices

When to use

  • A shortcut for power users, on canvases, files and list rows.
  • Never the only way to an action: put the same items behind a visible ⋯ DropdownMenu.

Behavior

  • Order items as the dropdown does, so muscle memory carries across both.
  • Mark the target while open with data-[state=open] styles on the trigger.
  • Shortcuts are display only; bind them elsewhere.

Accessibility

  • Make the trigger focusable (tabIndex={0}) so Shift+F10 and the Menu key reach it.
  • Give an unlabelled area an aria-label that mentions the menu.
  • Focus returns to the trigger on Esc.

Content

  • Short verbs. Destructive last, behind a separator.
  • A label row naming the object helps when the target is small.