Skip to content

ContextMenuItem

Since v0.1.1

Context menu item definition. Supports icons, shortcuts, submenus, separators, group headers (labelled separators), and dynamic disabled/hidden states.

PropertyTypeDescription
idstringUnique identifier for the menu item
namestringDisplay label for the menu item
icon?stringOptional icon (HTML string, emoji, or icon class)
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 | (params: ContextMenuParams) => booleanWhether the item is disabled (static or dynamic)
hidden?boolean | (params: ContextMenuParams) => booleanWhether the item is hidden (static or dynamic)
action?(params: ContextMenuParams) => voidAction handler when the item is clicked
subMenu?ContextMenuItem[]Nested submenu items
separator?booleanWhether this is a separator (id and name required but ignored)
label?stringTurns a separator into a group header — a divider with this text inline, labelling the items that follow it. Only read when separator: true. v3.11.0+
cssClass?stringOptional CSS class to add to the menu item

Turns a separator into a group header — a divider with this text inline, labelling the items that follow it. Only read when separator: true.

Like plain separators, group headers are not focusable or clickable. A header whose group has no visible items (all hidden) is dropped automatically, and a plain separator directly before a header is absorbed by it. Unlike a plain separator, a header may lead the menu.

{ id: 'row-group', name: '', separator: true, label: 'Row' }