HeaderContextMenuItem
Context menu item contributed by plugins via the getContextMenuItems query.
Plugins return these from handleQuery({ type: 'getContextMenuItems' }) to add
items to the right-click context menu. Unlike user-configured ContextMenuItem,
these are lightweight and statically typed — no dynamic disabled/hidden callbacks
(the plugin decides at query time what to include).
Example
Section titled “Example”override handleQuery(query: PluginQuery): unknown { if (query.type === 'getContextMenuItems') { const { column } = query.context as ContextMenuParams; return [ { id: 'hide-column', label: 'Hide Column', icon: '👁', action: () => this.hideColumn(column.field) }, ] satisfies HeaderContextMenuItem[]; }}Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
id | string | Unique identifier for the menu item |
label | string | Display label |
icon? | string | Optional icon (HTML string, emoji, or SVG string) |
shortcut? | string | string[] | Optional keyboard shortcut hint (display only). String array renders as key combo (e.g. [‘Ctrl’, ‘A’] → <code>Ctrl</code>+<code>A</code>) |
disabled? | boolean | Whether the item is disabled |
action | () => void | Action handler when the item is clicked |
separator? | boolean | Whether this is a separator (only id is required) |
cssClass? | string | Optional CSS class to add to the menu item (e.g. ‘danger’) |
order? | number | Sort order for positioning within the menu. Lower values appear first. Default is 100. Built-in ranges: sort (10-19), filter (20-29), visibility (30-39), pinning (40-49). |
AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://raw.githubusercontent.com/OysteinAmundsen/toolbox/main/llms-full.txt