Skip to content

Interface: ToolbarItemFields<S>

Defined in: packages/sdk/src/toolbar-items.ts:43

Shared fields for interactive toolbar contributions. Render chrome is driven by icon + title:

icontitleControl
icon-only
text-only
icon + text

Icons are Phosphor export names (PhosphorIconName); the host resolves and paints them bold at 1em so they match local-web-viewer and track UI zoom. Pass a React node is no longer supported — use the name.

Extended by

Type Parameters

S

S extends ToolbarSurface = ToolbarSurface

Properties

id

ts
id: string;

Defined in: packages/sdk/src/toolbar-items.ts:45

Unique id for this contribution.


surface

ts
surface: S;

Defined in: packages/sdk/src/toolbar-items.ts:47

Which toolbar to contribute to.


icon?

ts
optional icon?: string;

Defined in: packages/sdk/src/toolbar-items.ts:52

Leading glyph as a PhosphorIconName (e.g. "Flag"). Omit for a text-only control (requires title).


title?

ts
optional title?: string;

Defined in: packages/sdk/src/toolbar-items.ts:57

Visible label painted in the control. Omit for icon-only. When both icon and title are set, the host renders icon + text.


tooltip?

ts
optional tooltip?: string;

Defined in: packages/sdk/src/toolbar-items.ts:59

Hover tooltip (falls back to title / label / command label).


label?

ts
optional label?: string;

Defined in: packages/sdk/src/toolbar-items.ts:65

Accessible name (falls back to title / the command's label). Always used for aria-label; not painted unless title is also set.


order?

ts
optional order?: number;

Defined in: packages/sdk/src/toolbar-items.ts:67

Ordering within the trailing cluster; lower sorts first.


when?

ts
optional when?: (ctx, target) => boolean;

Defined in: packages/sdk/src/toolbar-items.ts:71

Visibility predicate. Returning false hides the item for this target.

Parameters

ctx

ContextKeys

target

ToolbarItemContext[S]

Returns

boolean


checked?

ts
optional checked?: (ctx, target) => boolean;

Defined in: packages/sdk/src/toolbar-items.ts:77

Toggle-state predicate for command items. When provided, the host renders the control in a pressed/checked visual state whenever this returns true. Menu items put checks on individual MenuEntry rows instead.

Parameters

ctx

ContextKeys

target

ToolbarItemContext[S]

Returns

boolean