Skip to content

Interface: ToolbarMenuItemContribution<S>

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

Menu-backed toolbar control — click opens a host dropdown via UiService.showMenu with entries from ToolbarMenuItemContribution.menu.

Extends

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.

Inherited from

ToolbarItemFields.id


surface

ts
surface: S;

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

Which toolbar to contribute to.

Inherited from

ToolbarItemFields.surface


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).

Inherited from

ToolbarItemFields.icon


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.

Inherited from

ToolbarItemFields.title


tooltip?

ts
optional tooltip?: string;

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

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

Inherited from

ToolbarItemFields.tooltip


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.

Inherited from

ToolbarItemFields.label


order?

ts
optional order?: number;

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

Ordering within the trailing cluster; lower sorts first.

Inherited from

ToolbarItemFields.order


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

Inherited from

ToolbarItemFields.when


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

Inherited from

ToolbarItemFields.checked


ts
menu: (target) => 
  | MenuEntry[]
| Promise<MenuEntry[]>;

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

Build the dropdown for this target. May be sync or async. The host anchors the menu on the toolbar control (align: "end", toggle on).

Parameters

target

ToolbarItemContext[S]

Returns

| MenuEntry[] | Promise<MenuEntry[]>


command?

ts
optional command?: undefined;

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


type?

ts
optional type?: undefined;

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