Skip to content

pivotick v3.0.0


pivotick / GraphUI / MenuActionItemOptions

Type Alias: MenuActionItemOptions<TThis> ​

MenuActionItemOptions<TThis> = object

Defined in: interfaces/GraphUI.ts:1134

Options to define an action item in a menu. Can be used in contextual menus or multi-select menus.

Type Parameters ​

TThis ​

TThis extends UIElement = UIElement

Properties ​

dividerBefore? ​

optional dividerBefore: boolean

Defined in: interfaces/GraphUI.ts:1169

Draw a rule above this row, to group what follows apart from what came before.


iconClass? ​

optional iconClass: IconClass

Defined in: interfaces/GraphUI.ts:1137


iconUnicode? ​

optional iconUnicode: IconUnicode

Defined in: interfaces/GraphUI.ts:1136

Unicode character for the icon (optional)


imagePath? ​

optional imagePath: ImagePath

Defined in: interfaces/GraphUI.ts:1139


onclick()? ​

optional onclick: (this, evt, element?) => void

Defined in: interfaces/GraphUI.ts:1148

Optional: a row that only opens a MenuActionItemOptions.submenu needs no action of its own.

Parameters ​

this ​

TThis

evt ​

PointerEvent | MouseEvent

element? ​

Node | Node[] | Edge | Edge[] | Note | Note[] | null

Returns ​

void


shortcut? ​

optional shortcut: string

Defined in: interfaces/GraphUI.ts:1171

The keybinding activates this function. This is just visual. The actual binding is defined in UIManager


optional submenu: MenuActionItemOptions<TThis>[] | (element) => MenuActionItemOptions<TThis>[]

Defined in: interfaces/GraphUI.ts:1157

Rows that open in a panel beside this one, which then carries the click. The function form is resolved every time the menu opens, so a submenu may depend on the element it was opened over.

A row with a submenu keeps its own onclick if it has one; the click opens the panel either way, and closes it again on a second click.


suffix? ​

optional suffix: HTMLElement

Defined in: interfaces/GraphUI.ts:1167

An element pinned to the row's right-hand end, after the label — a count, a badge, anything the row's own text should not have to carry.

Held by the caller rather than described to the library, so it can still be written to once the menu is drawn: a value that is still being fetched fills its slot when it arrives. An element is in one place at a time, so a row built fresh on every open needs a fresh one too.


svgIcon? ​

optional svgIcon: SVGIcon

Defined in: interfaces/GraphUI.ts:1138


text ​

text: string

Defined in: interfaces/GraphUI.ts:1141

Text of the option.


title? ​

optional title: string

Defined in: interfaces/GraphUI.ts:1143

Title to be shown when hovering over the option.


variant? ​

optional variant: UIBaseVariant | UIOutlineVariant | UIOutlineSoftVariant

Defined in: interfaces/GraphUI.ts:1145

Default ​

ts
outline-primary

visible? ​

optional visible: boolean | (element) => boolean

Defined in: interfaces/GraphUI.ts:1146