SheetXL - v0.8.0-beta.9+sites.210.e2d420901
    Preparing search index...

    Interface CommandButtonEntry<STATE, CONTEXT>

    The one thing the command-button registry deals in - a button or a panel (group). One shape, whether it becomes a plain button, a split button, a popup, or a fully custom control.

    There is one reference concept: key. A registered entry has a key (its id); a member is a key - a bare string, resolved registry-first against that same registry (a registered entry if one exists, otherwise a plain command). The same shape also appears keyless and inline as a member ({ key, state, render, … } = a reference + overrides, or a keyless nested panel). Keys are a single namespace: an entry key must not shadow a command key, so a reference always means exactly one thing. What an entry becomes:

    • members - a list; its presence makes the entry a panel (group) (isCommandGroup).
    • defaultKey - a split button's quick action (the command its primary half runs).
    • render - a fully custom control (the escape hatch); omit for the default button / split / popup.
    interface CommandButtonEntry<STATE = any, CONTEXT = any> {
        contributions?: Record<string, Placement>;
        defaultKey?: string;
        getDescription?: (
            groupKey?: string,
        ) => string | ReactElement<unknown, string | JSXElementConstructor<any>>;
        getIcon?: (
            groupKey?: string,
        ) =>
            | string
            | ReactElement<unknown, string | JSXElementConstructor<any>>
            | null
            | undefined;
        getLabel?: (
            groupKey?: string,
        ) => string | ReactElement<unknown, string | JSXElementConstructor<any>>;
        key?: string;
        members?: (string | CommandButtonEntry<any, any> | null)[];
        render?: (
            props: CommandButtonProps<STATE, CONTEXT>,
            groupKey?: string,
        ) => ReactElement;
        showLabel?: boolean;
        state?: STATE;
    }

    Type Parameters

    • STATE = any
    • CONTEXT = any
    Index
    contributions?: Record<string, Placement>

    Destinations this entry injects itself into, keyed by destination panel key - each value a Placement describing where in that panel this entry lands. Woven into the destination by ICommandButtonRegistry.resolveMembers.

    defaultKey?: string

    A split button's quick action - the command key its primary ("quick") half runs, next to the members dropdown. A command-registry key (distinct from this entry's own key); omit for a plain popup (head just opens the list).

    getDescription?: (
        groupKey?: string,
    ) => string | ReactElement<unknown, string | JSXElementConstructor<any>>

    Description (usually the tooltip).

    getIcon?: (
        groupKey?: string,
    ) =>
        | string
        | ReactElement<unknown, string | JSXElementConstructor<any>>
        | null
        | undefined

    Icon. A string resolves via DynamicIcon. Return null to render no icon (a deliberate blank); return undefined - or omit the getter - to let the resolved command supply its own.

    getLabel?: (
        groupKey?: string,
    ) => string | ReactElement<unknown, string | JSXElementConstructor<any>>

    Label (usually the button / menu text). groupKey = the panel it renders in (rarely needed).

    key?: string

    The one reference. On a registered entry it is its id (how it is referenced / injected / replaced; ICommandButtonRegistry.register requires it). On a member it is what to resolve, registry-first (a registered entry, else a plain command) - so a bare-string member is shorthand for { key }.

    members?: (string | CommandButtonEntry<any, any> | null)[]

    The ordered list members - each a key (string, resolved registry-first), a divider ('-' / null), or an inline entry. Its presence makes this entry a panel (group).

    render?: (
        props: CommandButtonProps<STATE, CONTEXT>,
        groupKey?: string,
    ) => ReactElement

    Optional custom renderer - the escape hatch. Omit for the default control (a button, a split button, or a popup, per the facets above). Provide to fully render it yourself - e.g. a host renders the same command its own way (the studio opens the Monaco pane, a VSCode host a native control), or a toggle group whose head reflects the active member. A panel entry's render receives the entry's own key as groupKey (so it can resolve its members); a leaf entry's render receives the resolved leaf button props. May render null internally to self-hide.

    showLabel?: boolean

    Render the entry's label as visible content on a toolbar button (in addition to any icon / split-toggle checkmark), not just as its tooltip. Toolbar buttons are icon-only by default; set this for the deliberate text buttons (e.g. Gridlines, Workbook View) and the icon+text ones (e.g. Text to Columns). No effect on menu items, which always show their label.

    false
    
    state?: STATE

    Optional state passed to the resolved command on execute (parameterizes a reused command).