Components/Context Menu

Context Menu

A menu that appears on right-click (or long-press on touch). The menu is positioned at the click point.


Right-click here

Installation

npx ajaxui add context-menu

Notes

Anatomy

<ContextMenu>                  // right-click state owner
  <ContextMenuTrigger/>        // wraps the area that gets the menu
  <ContextMenuContent>
    <ContextMenuItem/>
    <ContextMenuSeparator/>
    <ContextMenuSub>
      <ContextMenuSubTrigger/>
      <ContextMenuSubContent/>
    </ContextMenuSub>
  </ContextMenuContent>
</ContextMenu>

Props

PropTypeDefaultDescription
asChildboolean (on Trigger)Forwards onContextMenu to the child element.
disabledboolean (on Item)Disables an item.
destructiveboolean (on Item)Highlights destructive actions in red.
onSelect() => void (on Item)