Context Menu

Actions for an area, opened with a right-click on desktop and a long-press on touch screens.
Stable
Web
iOS
Android
@advui/core
Source

Browser-style menu

Right-click here (long-press on touch)

Installation

pnpm
pnpm add @advui/core
npm
npm install @advui/core

Usage

import { ContextMenu } from '@advui/core'

<ContextMenu>
  <ContextMenu.Trigger>
    <FileRow file={file} />
  </ContextMenu.Trigger>
  <ContextMenu.Content>
    <ContextMenu.Item onSelect={rename}>Rename</ContextMenu.Item>
    <ContextMenu.Separator />
    <ContextMenu.Item destructive onSelect={remove}>Delete</ContextMenu.Item>
  </ContextMenu.Content>
</ContextMenu>

Examples

Rows in a list

Each row has its own menu.
Quarterly report.pdf2.4 MB
Brand guidelines.pdf8.1 MB
Invoice 0042.pdf120 KB

API reference

ContextMenu

PropTypeDefaultDescription
onOpenChange(open: boolean) => void—Called when the menu opens or closes.

ContextMenu.Trigger

Takes View props to size and style the area.
PropTypeDefaultDescription
children requiredReactNode—The area that opens the menu: a card, a row, a canvas…
disabledboolean—Ignore right-click and long-press.

ContextMenu.Content

PropTypeDefaultDescription
minWidth'40' | '48' | '56' | '64''48'Minimum menu width.Web only.

ContextMenu.Item

The same parts and props as Dropdown Menu.
PropTypeDefaultDescription
onSelect() => void—Called when chosen; the menu closes.
iconReactNode—Leading icon.
shortcutstring—Keyboard hint on the right.Web only.
destructiveboolean—Style as a dangerous action.
disabledboolean—Skip this item.

ContextMenu.CheckboxItem

PropTypeDefaultDescription
checkedboolean—Checked state.
onCheckedChange(checked: boolean) => void—Called with the new state.

ContextMenu.RadioGroup

PropTypeDefaultDescription
valuestring—Selected item.
onValueChange(value: string) => void—Called with the chosen value.

ContextMenu.RadioItem

PropTypeDefaultDescription
value requiredstring—Item value.

ContextMenu.Label

A heading for the items after it.

ContextMenu.Separator

A line between groups of items.

ContextMenu.Group

Groups items under a Label for screen readers.

Accessibility

  • Context menus are hidden until someone thinks to look for them: offer the same actions somewhere visible too (a Dropdown Menu on the row, a toolbar).
  • Once open, the menu follows the WAI-ARIA menu pattern, like Dropdown Menu: menuitem, menuitemcheckbox and menuitemradio with aria-checked; focus moves into the menu and back afterwards.
  • Keyboard users open it with Shift+F10 or the Menu key while focus is inside the area.
  • On iOS and Android the area is one accessible element with a "long press" action (listed by VoiceOver and TalkBack) and the hint "Long press for options".
Keyboard interactions
KeyAction
Shift+F10 / MenuOpens the menu from focus inside the area.
↓ / ↑Moves between items (disabled items are skipped).
Enter / SpaceChooses the focused item.
A–ZType-ahead to an item.
EscCloses the menu.

Responsive behavior

The menu opens at the pointer and flips to stay inside the viewport.

Platform notes

Web
Opens at the pointer on right-click, and after a long-press on touch screens.
iOS
A long-press opens Dropdown Menu’s bottom sheet (native menus need a native module that Expo Go does not include). Shortcut hints are hidden.
Android
Same as iOS; the back gesture closes the sheet.
Since v0.3.0Last updated Nov 2, 2026Edit this page on GitHub