Skip to content

charton API


charton API / @chart-on/ui / index / ContextMenuItem

Type Alias: ContextMenuItem ​

ContextMenuItem = { danger?: boolean; disabled?: boolean; icon?: IconSource; id: string; label: string; onSelect: ContextMenuSelectHandler; type: "action"; } | { checked: boolean; id: string; label: string; onSelect: ContextMenuSelectHandler; type: "check"; } | { icon?: IconSource; id: string; items: ContextMenuItem[]; label: string; type: "submenu"; } | { label: string; type: "label"; } | { type: "separator"; }

Defined in: ui/src/context-menu.ts:18

An entry of the chart's context menu: an action, a check toggle, a submenu, a heading or a separator.

Union Members ​

Type Literal ​

{ danger?: boolean; disabled?: boolean; icon?: IconSource; id: string; label: string; onSelect: ContextMenuSelectHandler; type: "action"; }

danger styles a destructive action, e.g. Remove.


Type Literal ​

{ checked: boolean; id: string; label: string; onSelect: ContextMenuSelectHandler; type: "check"; }

A toggle shown with a check mark (menuitemcheckbox).


Type Literal ​

{ icon?: IconSource; id: string; items: ContextMenuItem[]; label: string; type: "submenu"; }

Opens a nested menu: on click, hover, Arrow Right, Enter or Space; Arrow Left or Escape closes it.


Type Literal ​

{ label: string; type: "label"; }

A heading that is not an item, e.g. the name of what the menu is for. The first one also names the menu.


Type Literal ​

{ type: "separator"; }