pivotick - v3.0.0
    Preparing search index...

    Interface TopBarAction

    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.

    interface TopBarAction {
        enabled?: boolean | ((graph: Pivotick) => boolean);
        iconClass?: string;
        id: string;
        menu?:
            | MenuActionItemOptions<UIElement>[]
            | ((ctx: TopBarActionContext) => MenuActionItemOptions<UIElement>[]);
        onclick?: (
            evt: MouseEvent | KeyboardEvent,
            ctx: TopBarActionContext,
        ) => void | Promise<void>;
        placement?: "end" | "start";
        shortcut?: string;
        svgIcon?: string;
        text: string | ((graph: Pivotick) => string);
        title?: string | ((graph: Pivotick) => string);
        visible?: boolean | ((graph: Pivotick) => boolean);
    }
    Index

    Properties

    enabled?: boolean | ((graph: Pivotick) => boolean)

    false draws the pill disabled.

    true
    
    iconClass?: string
    id: string

    Stable id: the pill's data-action, and the key UIManager.removeTopBarAction takes.

    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?: (
        evt: MouseEvent | KeyboardEvent,
        ctx: TopBarActionContext,
    ) => void | Promise<void>

    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.

    placement?: "end" | "start"

    'start' follows the built-in pills on the left; 'end' sits just before the undo-redo group on the right. Declaration order within each.

    'end'
    
    shortcut?: string

    Shown as a badge on the pill. Visual only: the binding is the host's to register.

    svgIcon?: string
    text: string | ((graph: Pivotick) => string)

    The label: "Save as graph", then "Update graph" once saved.

    title?: string | ((graph: Pivotick) => string)

    Shown on hover.

    visible?: boolean | ((graph: Pivotick) => boolean)

    false draws no pill.

    true