Appica UIUI 1.0.0

Context Menu

A menu that opens where you right-click or long-press.

Right-click here

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 a div by default; pass className or render to wrap your own content.
  • ContextMenuContent — the portalled popup, positioned at the pointer. Accepts the shared floating props (side, align, sideOffset, …).
  • ContextMenuItem — one action. Fires onClick and 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.

Right-click here

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.

Right-click the canvas

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.

انقر بزر الفأرة الأيمن هنا

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 are menuitem, menuitemcheckbox, or menuitemradio.
  • 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.
  • disabled items are skipped by keyboard navigation and typeahead.
  • Popup enter/exit transitions are skipped when the user prefers reduced motion.

© 2026 Appica UI. A free component library, crafted by the Appica team.