Skip to content

Context Menu

Right-click menu anchored at the pointer. Portal-mounted, viewport-clamped, keyboard-navigable. Same item shape as Dropdown Menu.

Overlays & Feedback·Available inReactVueAngular·View as Markdown

Preview

tsx
Right-click anywhere in this area

Switch the framework picker (top-right of the panel) to render the same demo live in React, Vue, or Angular — same class names, ARIA, and visual output across all three.

Installation

Sisyphos UI ships unified packages for React, Vue, and Angular. Pick the one that matches your stack — every framework exports the same component classes, ARIA semantics, and CSS tokens.

$ pnpm add @sisyphos-ui/react

Then import the bundled stylesheet once at app entry: import "@sisyphos-ui/react/styles.css";

Usage

Idiomatic usage in each supported framework
import { ContextMenu } from "@sisyphos-ui/react";

export const Row = () => (
  <ContextMenu items={[
    { label: "Open", onSelect: () => {} },
    { label: "Rename", onSelect: () => {} },
    { type: "separator" },
    { label: "Delete", destructive: true, onSelect: () => {} },
  ]}>
    <div className="row">Right-click me</div>
  </ContextMenu>
);

Labeled sections

`type: "label"` renders a non-interactive section header. Perfect for grouping destructive actions.

tsx
Project · Q2 launch.md

Per-row table menu

Wrap each `<tr>` in its own `<ContextMenu>` so each row gets a menu scoped to its data.

tsx
NameRole
Ada LovelaceAdmin
Alan TuringMember
Grace HopperMember

Right-click any row.

API

PropTypeDefaultDescription
items*ContextMenuItem[]Actions, separators, and labels rendered inside the menu.
children*ReactElementThe trigger — any element that accepts `onContextMenu`.
marginnumber8Viewport margin so the menu never sits flush against an edge.
disabledbooleanfalseWhen true, right-click is a no-op.
emptyStateReactNodeRendered when `items` is empty.
onOpenChange(open: boolean) => voidFires when the menu opens or closes.

The full API including refs, ARIA attributes, and HTML passthroughs lives in the package README on npm.

Accessibility

Adheres to the Menu WAI-ARIA design pattern.

Keyboard interactions

KeyAction
ArrowDownthenArrowUpMove between items.
HomethenEndJump to first / last item.
EnterthenSpaceActivate the focused item.
EscClose the menu; focus returns to the trigger.
TabClose the menu.
Need more?View on npm →
Was this page helpful?