HyContextMenu
A right-click (context) menu. Listens for contextmenu on a target element — either slotted via the target slot or selected via the target CSS selector — and opens an hy-menu anchored to the pointer coordinates.
The anchor is a 1×1 invisible element positioned with position: fixed at the click point; hy-popover then lays the panel out relative to it using standard placement rules.
Slots vs. selector
The slotted target wins when both are set. Pointer-events on the slotted content are untouched — the host uses display: contents so the target stays in its natural layout position.
Disabled
When disabled, listeners stay attached but suppress opening. This lets consumers gate on app state (e.g. "no row selected") without juggling listener lifecycles.
Events
- select -
{ value, item, x, y, target }— adds pointer origin and the triggering element to the standard menu select detail.targetisnullfor programmaticshow(x, y)calls. - show - Relayed from the underlying menu (does NOT bubble).
- hide - Relayed from the underlying menu (does NOT bubble).
Slots
- target - The element to listen on.
- default -
hy-menu-item/ checkable variants / groups / dividers.
Methods
show()
Programmatically open the menu at the given viewport coordinates.
When contextTarget is provided it becomes the target field of the next select event detail — useful when opening the menu from custom pointer handlers that already know the row/node the user acted on.