Skip to content

Plugin.addRibbonIcon method

Plugin › addRibbonIcon

Official

Adds a ribbon icon to the left bar.

Signature:

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

Parameters:

ParameterTypeDescription
iconstringThe icon name to be used. See {@link obsidian#addIcon}.
titlestringThe title to be displayed in the tooltip.
callback(evt: MouseEvent) => unknownThe click callback.

Returns: HTMLElementThe HTMLElement for the ribbon icon.

Since: 0.9.7

Example:

plugin.addRibbonIcon('dice', 'foo', (evt) => {
console.log('clicked');
});