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:

Parameter Type Description
icon string The icon of the action.
title string The title of the action.
callback (evt: MouseEvent) => unknown The 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');
});