Context menu
stable 2.3 kB<hkContextMenu>A right-click menu that clamps itself inside its container, so it never opens half off-screen near an edge.
#menu#right-click
Live demo
Running in this page — interact with it.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| hkContextMenu | HkMenuItem[] | [] | Items to show. |
| disabled | boolean | false | Falls back to the browser menu. |
Outputs
menuSelectEventEmitter<HkMenuItem>Emits the chosen item.
Keyboard
- Shift + F10 / Menu key Opens the menu from the keyboard
- ↑ / ↓ Moves through items
- Escape Closes and restores focus
Theming
Component tokens, each falling back to a global one:
| Property | Default | Controls |
|---|---|---|
| --hk-context-bg | #ffffff | Panel background. |
| --hk-context-danger | #dc2626 | Colour for destructive items. |
Accessibility
- Opens from the keyboard menu key as well as right-click — otherwise the actions are mouse-only.
- Coordinates are clamped to the container, so the panel is always fully visible.
- Focus returns to the target element on close.