Skip to content
SENVENLI UI

Context menu

The actions for what is under the pointer, opened by a right-click, a long press or Shift+F10.
On a row
import { ContextMenu, ContextMenuTrigger } from "@senvenli/react/overlay";

Examples

Composed from parts

A `ContextMenuTrigger` holds the region; the parts after it are the menu.
report.pdf · right-click or long-press

Guidelines

When to use it

  • Rows, cards or a canvas where people expect right-click actions.

Use something else when

  • The actions belong to a visible button. Menu

Do and avoid

  • Never the only way to an action: put it in a visible Menu too.
  • Same order as the row's menu.

Accessibility

Built in

  • Opens at the pointer, or under the focused element with Shift+F10 or the Menu key; focus goes back on close.

You provide

  • An aria-label for the menu.
  • With children: a textValue on a MenuItem whose label is not plain text, so typing can jump to it; the destructive item last, after a MenuSeparator.

API reference

ContextMenu

childrenRequired
React.ReactNode

The region a right-click, a long press or Shift+F10 opens the menu on: a row, a card, a canvas. Or, to compose the menu from parts: a ContextMenuTrigger holding that region, followed by MenuItem, MenuSection, MenuSubmenu and MenuSeparator.

items
readonly MenuEntry[]

The menu as data; leave it out when composing with a ContextMenuTrigger.

onAction
(id: Key) => void
disabledKeys
Iterable<Key>
aria-labelRequired
string

Names the menu ("Actions for ORD-482").

ContextMenuTrigger

childrenRequired
React.ReactNode

The region that opens the menu.