Command class

Represents a command belonging to a command set.

Remarks

The BaseListViewCommandSet extension type exposes generalized commands that may be displayed as tool bar buttons, context menu items, etc. These commands are initially defined in the extension's manifest file. At runtime, the corresponding Command object can be obtained by calling BaseListViewCommandSet.tryGetCommand(). The command's appearance can be customized by assigning its properties, for example to hide a command that is not contextually relevant, or to pluralize the title based on the number of selected items.

Properties

ariaLabel

Custom accessibility text for the browser's "aria-label" attribute. If omitted, the title property will be used by default. Example: "Show information. Press ENTER to select."

disabled

Whether the command is currently disabled.

iconImageUrl

An optional URL for an image to be displayed next to the command. The requirements for this image are defined by the type of extension; some extension types may not display the image at all.

id

Id of the command.

title

A short label to be displayed by the associated button, menu item, etc.

visible

True if the command is visible.

Property Details

ariaLabel

Custom accessibility text for the browser's "aria-label" attribute. If omitted, the title property will be used by default. Example: "Show information. Press ENTER to select."

ariaLabel: string | undefined;

Property Value

string | undefined

disabled

Whether the command is currently disabled.

disabled: boolean | undefined;

Property Value

boolean | undefined

iconImageUrl

An optional URL for an image to be displayed next to the command. The requirements for this image are defined by the type of extension; some extension types may not display the image at all.

iconImageUrl: string | undefined;

Property Value

string | undefined

Remarks

This must be a absolute URL.

id

Id of the command.

id: string;

Property Value

string

title

A short label to be displayed by the associated button, menu item, etc.

title: string;

Property Value

string

Remarks

Example: "Show information"

Altering the title property is intended to allow minor changes to the title, e.g. “Submit these 3 items” or toggling between “Schedule” and “Unschedule”. Developers are discouraged from assigning a title that radically alters the meaning of the command, because administrators should be able to examine the extension manifest to understand which commands are being implemented by a given extension.

visible

True if the command is visible.

visible: boolean;

Property Value

boolean