pivotick - v2.0.1
    Preparing search index...

    Type Alias MenuActionItemOptions<TThis>

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

    type MenuActionItemOptions<TThis extends UIElement = UIElement> = {
        dividerBefore?: boolean;
        iconClass?: IconClass;
        iconUnicode?: IconUnicode;
        imagePath?: ImagePath;
        onclick?: (
            this: TThis,
            evt: PointerEvent | MouseEvent,
            element?: Node | Node[] | Edge | Edge[] | Note | Note[] | null,
        ) => void;
        shortcut?: string;
        submenu?:
            | MenuActionItemOptions<TThis>[]
            | ((element: Node | Edge | Note | null) => MenuActionItemOptions<TThis>[]);
        suffix?: HTMLElement;
        svgIcon?: SVGIcon;
        text: string;
        title?: string;
        variant?: UIBaseVariant | UIOutlineVariant | UIOutlineSoftVariant;
        visible?: boolean | ((element: Node | Edge | Note | null) => boolean);
    }

    Type Parameters

    Index

    Properties

    dividerBefore?: boolean

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

    iconClass?: IconClass
    iconUnicode?: IconUnicode

    Unicode character for the icon (optional)

    imagePath?: ImagePath
    onclick?: (
        this: TThis,
        evt: PointerEvent | MouseEvent,
        element?: Node | Node[] | Edge | Edge[] | Note | Note[] | null,
    ) => void

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

    shortcut?: string

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

    submenu?:
        | MenuActionItemOptions<TThis>[]
        | ((element: Node | Edge | Note | null) => MenuActionItemOptions<TThis>[])

    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?: HTMLElement

    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?: SVGIcon
    text: string

    Text of the option.

    title?: string

    Title to be shown when hovering over the option.

    outline-primary
    
    visible?: boolean | ((element: Node | Edge | Note | null) => boolean)