Context Menu
A menu opened by right-clicking or long-pressing an area, built from a slotted c2-menu or a render function per clicked spot.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
disabled | boolean | false | Ignores right clicks and long presses, so the browser shows its own menu. |
long-press-duration | number | 500 | How long, in milliseconds, a finger or pen must rest before the menu opens. |
menu-label | string | — | Accessible name of a menu built by renderContextMenu. A slotted menu takes its own aria-label. |
Slots
| Name | Description |
|---|---|
default | The area that opens the menu. |
menu | A c2-menu shown when renderContextMenu is not set or returns nothing. |
Events
| Name | Type | Description |
|---|---|---|
context-menu-open | CustomEvent<ContextMenuContext> | Fired before the menu opens, with the context as detail. Cancelable: preventDefault() keeps the menu closed and lets the browser's menu show. |
context-menu-select | CustomEvent<ContextMenuSelectEventDetail> | Fired when a row is activated: the row's value, checked and data, plus the context the menu was opened on. The row's own menu-select still bubbles as well. |
toggle | ToggleEvent | Fired after the menu opens or closes; newState is open or closed. |