Dinachi

Context Menu

A menu triggered by right-clicking an element, providing contextual actions and options.

View Source

#Installation

npx @dinachi/cli@latest add context-menu

#Usage

tsx
import {
  ContextMenu,
  ContextMenuTrigger,
  ContextMenuPortal,
  ContextMenuPositioner,
  ContextMenuContent,
  ContextMenuItem,
  ContextMenuCheckboxItem,
  ContextMenuRadioGroup,
  ContextMenuRadioItem,
  ContextMenuGroup,
  ContextMenuLabel,
  ContextMenuSeparator,
  ContextMenuShortcut,
  ContextMenuSub,
  ContextMenuSubTrigger,
  ContextMenuSubContent,
} from '@/components/ui/context-menu'

#Examples

#API Reference

PropTypeDefaultDescription
defaultOpenbooleanfalseThe initial open state when uncontrolled.
openbooleanThe controlled open state of the context menu.
onOpenChange(open: boolean) => voidCallback fired when the open state changes.
loopFocusbooleantrueWhether to loop keyboard focus back to the first item when the end is reached.
disabledbooleanfalseWhether the context menu should ignore user interaction.
ContextMenuItem.insetbooleanfalseAdds indentation for nested command-style layouts.
ContextMenuCheckboxItem.checkedbooleanThe controlled checked state of the checkbox item.
ContextMenuCheckboxItem.onCheckedChange(checked: boolean) => voidCallback fired when the checkbox item is toggled.
ContextMenuRadioGroup.valueanyThe controlled value of the selected radio item.
ContextMenuRadioGroup.onValueChange(value: any) => voidCallback fired when the selected radio value changes.