Context Menu
A menu that opens where you right-click or long-press.
Usage
ContextMenu is a compound component built on Base UI's Context Menu. Unlike a menu opened from a button, its trigger is the target area itself:
ContextMenuTrigger— the region that opens the menu on right-click / long-press. Renders adivby default; passclassNameorrenderto wrap your own content.ContextMenuContent— the portalled popup, positioned at the pointer. Accepts the shared floating props (side,align,sideOffset, …).ContextMenuItem— one action. FiresonClickand closes the menu by default.ContextMenuGroup/ContextMenuGroupLabel/ContextMenuSeparator— structure for sectioned lists.ContextMenuCheckboxItem/ContextMenuRadioGroup+ContextMenuRadioItem— stateful options with a check indicator.ContextMenuLinkItem— an item that renders an<a>for navigation.ContextMenuSub/ContextMenuSubTrigger/ContextMenuSubContent— a nested submenu.
Reach for a ContextMenu for actions tied to a specific object (a file, a row, a canvas) that users invoke by right-clicking it. For a menu opened from a visible button, use a DropdownMenu instead — and consider offering both for discoverability.
Examples
Basic
Right-click the area to open a standard edit menu with leading icons and trailing Kbd shortcuts.
On a card
The trigger can wrap any content — here a file card. Right-click it for object-specific actions, including a "Move to" submenu and a destructive delete.
Checkbox & radio items
The same stateful items as DropdownMenu: ContextMenuCheckboxItem toggles booleans (and keeps the menu open), while a ContextMenuRadioGroup of ContextMenuRadioItems picks one value.
Sizes
size on the root scales the popup radius, item padding, and icon size — sm, md (default), or lg.
RTL
Every Appica UI component supports right-to-left layouts out of the box. Set the dir attribute on a container (commonly your <html> element) so CSS logical properties resolve correctly, and wrap your tree in DirectionProvider so direction-aware behavior — roving focus, popup placement, and submenu direction — follows the same direction.
The menu opens at the pointer and grows toward the inline-start side, with submenus and chevrons mirrored. For setup details and caveats, see the RTL guide.
Scoped RTL needs the direction on the positioner
The popup portals to <body>, so its start/end alignment mirrors from the document direction (read from CSS,
not from DirectionProvider) — automatic when <html dir="rtl">. If you instead scope RTL to a subtree of an LTR page,
set it on the positioner so alignment still mirrors: <ContextMenuContent positionerProps={{ dir: 'rtl' }}>. See
Floating popups in a scoped RTL region.
API reference
ContextMenu wraps Base UI's Context Menu. Each part forwards every remaining prop to the matching Base UI primitive, so anything it accepts works here — the tables below list the Appica additions and the most common props. See the Base UI docs for the complete API.
ContextMenu
The root. Holds the open state and the shared size; renders no DOM of its own.
ContextMenuTrigger
The target area. Right-click or long-press inside it opens the menu at the pointer. Renders a div by default and forwards every native prop.
ContextMenuContent
The portalled, pointer-positioned popup wrapping the list. Defaults to align="start" and sideOffset={2}, and accepts the shared floating props.
ContextMenuItem
One action in the menu.
ContextMenuCheckboxItem
A toggleable item with a check indicator. Keeps the menu open on click.
ContextMenuRadioGroup
Wraps a set of mutually exclusive ContextMenuRadioItems.
ContextMenuRadioItem
One option in a ContextMenuRadioGroup. Keeps the menu open on click.
ContextMenuLinkItem
An item that renders an <a> for navigation. Forwards every native anchor prop (href, target, rel, …).
ContextMenuGroup
Wraps one labelled section of items so a ContextMenuGroupLabel can name it.
ContextMenuGroupLabel
The visible heading for a ContextMenuGroup. Size-aware; must be rendered inside a ContextMenuGroup (or ContextMenuRadioGroup).
ContextMenuSeparator
A thin divider between items or groups.
ContextMenuSub
Wraps a nested submenu. Forwards Base UI's ContextMenu.SubmenuRoot.
ContextMenuSubTrigger
The item that opens a submenu; renders a trailing chevron. Submenus open on hover by default.
ContextMenuSubContent
The submenu popup. Defaults to opening on the inline-end side; otherwise identical to ContextMenuContent.
Accessibility
- The popup has
role="menu"; items aremenuitem,menuitemcheckbox, ormenuitemradio. - Opens on
contextmenu(right-click) or long-press; Shift + F10 and the dedicated Menu key open it from the keyboard when the trigger is focused. - ↑/↓ move the highlight, →/← open and close submenus, Enter selects, Escape closes, and typeahead jumps to matching items.
- Focus moves into the popup on open and returns to the triggering element on close.
disableditems are skipped by keyboard navigation and typeahead.- Popup enter/exit transitions are skipped when the user prefers reduced motion.