modules/system/assets/toolbox/controls/context-menu/README.md
Displays a context menu at a specified position.
document.addEventListener('contextmenu', '.some-container', function(ev) {
ev.preventDefault();
oc.ContextMenu.show({
pageX: ev.pageX,
pageY: ev.pageY,
items: [
{
name: 'Section Title'
},
{
name: 'Edit Content',
icon: 'pencil',
action: () => openIframe('/some/iframe/edit')
},
{
name: 'Edit Settings',
label: 'Ctrl+S',
icon: 'cog',
action: () => openIframe('/some/iframe/settings')
}
]
});
});
// Close the menu programmatically
oc.ContextMenu.hide();
| Option | Type | Description |
|---|---|---|
name | string | Display text for the menu item |
action | function | Click handler (if omitted, item is rendered as a title) |
icon | string | Icon name (without icon- prefix) |
label | string | Secondary label (e.g., keyboard shortcut) |