Context Menu

Overlay

A versatile context menu component that appears on right-click or long press, providing contextual actions and options with support for items, checkboxes, radio groups, separators, shortcuts, and nested submenus.

Installation

bash
1npx @dinachi/cli@latest add context-menu

Run the CLI command above to automatically install the component and its dependencies.

Examples

Default Context Menu

A basic context menu with menu items and shortcuts

Right click here

Context Menu with Checkbox

Context menu with checkbox items for toggleable options

Right click for checkbox menu

Context Menu with Radio Group

Context menu with radio group for single selection

Right click for radio menu
Current: pedro

Context Menu with Submenu

Context menu with nested submenus for hierarchical options

Right click for submenu

API Reference

PropTypeDefaultDescription
defaultOpen
booleanfalseWhether the context menu is open by default
open
booleanControls the open state of the context menu
onOpenChange
(open: boolean) => voidCallback fired when the context menu open state changes
disabled
booleanfalseWhether the context menu is disabled
children
required
React.ReactNodeThe content of the context menu