Skip to content

addIcon

Official

Adds an icon to the library.

Import:

import { addIcon } from 'obsidian';

Signature:

function addIcon(iconId: string, svgContent: string): void

Parameters:

Parameter Type Description
iconId string the icon ID.
svgContent string the content of the SVG.

Returns: void

Example:

addIcon('my-icon', '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><circle cx="50" cy="50" r="40"/></svg>');