Skip to content

pivotick v3.0.0


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? ​

optional enabled: boolean | (graph) => boolean

Defined in: interfaces/GraphUI.ts:72

false draws the pill disabled.

Default ​

ts
true

iconClass? ​

optional iconClass: 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.


optional menu: 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()? ​

optional onclick: (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 ​

TopBarActionContext

Returns ​

void | Promise<void>


placement? ​

optional placement: "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 ​

ts
'end'

shortcut? ​

optional shortcut: 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? ​

optional svgIcon: 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? ​

optional title: string | (graph) => string

Defined in: interfaces/GraphUI.ts:60

Shown on hover.


visible? ​

optional visible: boolean | (graph) => boolean

Defined in: interfaces/GraphUI.ts:70

false draws no pill.

Default ​

ts
true