ToolbarButtonItem
A pressable button in an environment's toolbar, drawn by the host.
@internote/canvas-sdkimport { ToolbarButtonItem } from '@internote/canvas-sdk';#Fields
alignWhere the host draws the button:
leading sits with the environment's other items; trailing moves it to the bar's far side, ahead of the system tier, which is the slot for an environment's primary action.leadingtrailingDefault
'leading'busyWhether work is in flight behind the button. The host draws working feedback, such as a spinner in place of the icon.
booleandisabledWhether the button is shown but cannot be pressed.
booleaniconAn icon name, resolved by the host's icon set.
stringidUnique within the environment's contribution. A duplicate throws at validation.
stringlabelThe accessible name and tooltip. A disabled button's label may carry the reason.
stringonPressCalled when the reader presses the button.
() => voidtextA visible caption drawn inside the button, beside the icon. Distinct from
label so the caption stays short ("Run") while the tooltip explains ("Sign in to run code").stringtypeMarks the item as a button.
'button'variantThe button's weight:
normal is transparent until hovered, like every toolbar control; subtle is the tinted register, for the one action an environment leads with.normalsubtleDefault
'normal'#Example
{ type: 'button', id: 'reset-view', icon: 'ZoomReset', label: 'Reset view', onPress: () => view.reset(ctx), disabled: !view.hasExplored(ctx) }Declared in packages/canvas-sdk/src/toolbar/types.ts:27.