Context Menu
A pointer and keyboard menu opened from a contextual gesture.
A pointer and keyboard menu opened from a contextual gesture.
Backed by Base UI Context Menu for upstream behavior and configuration. Zenos owns the public API, styling, and composition shown on this page.
Import
Section titled “Import”import { ContextMenu } from "@zentara-co/zenos-ui";Use Context Menu for actions associated with a specific surface. Keep important actions available elsewhere because contextual gestures are less discoverable than visible controls.
Selection items
Section titled “Selection items”Checkbox items manage independent options. Radio items belong to a group and select one value.
Submenus and shortcuts
Section titled “Submenus and shortcuts”Shortcut text communicates an existing application command. It does not register the keyboard handler.
Motion
Section titled “Motion”Context menus and submenus fade, scale, and move from their resolved side when opening, then reverse that movement when closing. Reduced-motion preferences remove the animation automatically.
Right-click each card. The first menu animates in and out. disableMotion makes the second appear and disappear immediately.
Custom styling
Section titled “Custom styling”Every compound part accepts className. Style the trigger directly, then style ContextMenu.Content separately because the popup is rendered in a portal. Stable data-slot attributes and Base UI’s data-highlighted state can target items, labels, separators, and shortcuts without replacing menu behavior.
ContextMenu.Root ContextMenu.Trigger ContextMenu.Content ContextMenu.Item ContextMenu.CheckboxItem ContextMenu.RadioGroup ContextMenu.RadioItem ContextMenu.Sub ContextMenu.Separator ContextMenu.Shortcut
API
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | — | Controlled open state. |
defaultOpen | boolean | false | Initial uncontrolled state. |
onOpenChange | (open: boolean, eventDetails) => void | — | Runs when visibility changes. |
side / align | Base UI position values | — | Popup placement supplied on Content. |
Content.disableMotion | boolean | false | Disables enter and exit motion on Content or SubContent. |
checked / onCheckedChange | boolean / (checked: boolean, eventDetails) => void | — | Controls a CheckboxItem selection. |
value / onValueChange | string / (value: string, eventDetails) => void | — | Controls the selected RadioGroup item. |
disabled | boolean | false | Prevents an item from receiving selection. |
Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props,
including className, style, aria-*, and data-*.
Accessibility
Section titled “Accessibility”Base UI supplies menu roles, roving focus, typeahead, disabled semantics, and dismissal. A focused trigger can open the menu with the platform context-menu key or Shift+F10; arrow keys move through items and Escape closes it. Do not make a context menu the only path to essential functionality.