Interface ContextMenuItemConfig

Configuration for a single context-menu item.

interface ContextMenuItemConfig {
    callback?: ItemAction;
    doAction?: ItemAction;
    doHover?: ItemAction;
    getEnabled?: ItemStateGetter;
    getShown?: ItemStateGetter;
    getTitle?: ItemTitleGetter;
    icon?: string | ItemIconGetter;
    items?: ContextMenuItemConfig[][];
    title?: string;
}

Properties

callback?: ItemAction

Legacy alias for doAction.

doAction?: ItemAction

Action invoked when the item is activated.

doHover?: ItemAction

Optional action invoked when the pointer enters the item.

getEnabled?: ItemStateGetter

Resolves whether the item is enabled for the current context.

Defaults to true.

getShown?: ItemStateGetter

Resolves whether the item is shown for the current context.

Defaults to true.

getTitle?: ItemTitleGetter

Dynamic item title resolver.

icon?: string | ItemIconGetter

Optional icon for this item. Either a static SVG markup string or a context-aware resolver returning one. The markup is rendered via innerHTML into the menu's icon column — stroke / fill colours that use currentColor will pick up the menu's icon-column colour automatically.

Items without an icon render normally; if at least one item in a menu has an icon, every item in that menu reserves the icon-column space so labels stay aligned.

Nested submenu item groups.

Each inner array represents a visual group.

title?: string

Static item title.

Ignored when getTitle is provided.