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:

Parameter Type Description
icon string The icon name to be used. See {@link obsidian#addIcon}.
title string The title to be displayed in the tooltip.
callback (evt: MouseEvent) => unknown The click callback.

Returns: HTMLElementThe HTMLElement for the ribbon icon.

Since: 0.9.7

Example:

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