pivotick / GraphUI / TopBarAction
Interface: TopBarAction
Defined in: interfaces/GraphUI.ts:54
One host pill in the top bar: an action on the whole canvas, such as saving it. Every function field is re-read on UIManager.refreshTopBar, after a data change, and once an onclick that returned a promise settles.
Properties
enabled?
optionalenabled:boolean| (graph) =>boolean
Defined in: interfaces/GraphUI.ts:72
false draws the pill disabled.
Default
trueiconClass?
optionaliconClass:string
Defined in: interfaces/GraphUI.ts:61
id
id:
string
Defined in: interfaces/GraphUI.ts:56
Stable id: the pill's data-action, and the key UIManager.removeTopBarAction takes.
menu?
optionalmenu:MenuActionItemOptions<UIElement>[] | (ctx) =>MenuActionItemOptions<UIElement>[]
Defined in: interfaces/GraphUI.ts:85
Rows behind a caret: the pill becomes a split button, the label running onclick and the caret opening these. The same row type as the context menus, without submenu. The function form gets the context, so a row can prompt too; it is called on every refresh and every open, and no rows means no caret.
onclick()?
optionalonclick: (evt,ctx) =>void|Promise<void>
Defined in: interfaces/GraphUI.ts:78
Runs on a click, or Enter / Space on the focused pill. A returned promise disables the pill until it settles, so a slow save cannot be started twice, then refreshes every action.
Parameters
evt
MouseEvent | KeyboardEvent
ctx
Returns
void | Promise<void>
placement?
optionalplacement:"end"|"start"
Defined in: interfaces/GraphUI.ts:68
'start' follows the built-in pills on the left; 'end' sits just before the undo-redo group on the right. Declaration order within each.
Default
'end'shortcut?
optionalshortcut:string
Defined in: interfaces/GraphUI.ts:87
Shown as a badge on the pill. Visual only: the binding is the host's to register.
svgIcon?
optionalsvgIcon:string
Defined in: interfaces/GraphUI.ts:62
text
text:
string| (graph) =>string
Defined in: interfaces/GraphUI.ts:58
The label: "Save as graph", then "Update graph" once saved.
title?
optionaltitle:string| (graph) =>string
Defined in: interfaces/GraphUI.ts:60
Shown on hover.
visible?
optionalvisible:boolean| (graph) =>boolean
Defined in: interfaces/GraphUI.ts:70
false draws no pill.
Default
true