Skip to content

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).

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[];
}
}
PropertyTypeDescription
idstringUnique identifier for the menu item
labelstringDisplay label
icon?stringOptional 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?booleanWhether the item is disabled
action() => voidAction handler when the item is clicked
separator?booleanWhether this is a separator (only id is required)
cssClass?stringOptional CSS class to add to the menu item (e.g. ‘danger’)
order?numberSort 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