Skip to content

ItemView.addAction method

ItemView › addAction

Official

Add an action to the item view.

Signature:

addAction(icon: string, title: string, callback: (evt: MouseEvent) => unknown): HTMLElement

Parameters:

ParameterTypeDescription
iconstringThe icon of the action.
titlestringThe title of the action.
callback(evt: MouseEvent) => unknownThe callback to call when the action is clicked.

Returns: HTMLElementThe DOM element of the action. To extract the constructor type, use ExtractConstructor<ItemView>.

Since: 1.1.0

Example:

const action = itemView.addAction('dice', 'foo', () => {
console.log('bar');
});