setIcon
Official
Insert an SVG into the element from an iconId. Does nothing if no icon associated with the iconId.
Import:
import { setIcon } from 'obsidian';Example:
setIcon(document.body, 'dice');Signature:
function setIcon(parent: HTMLElement, iconId: string): voidParameters:
| Parameter | Type | Description |
|---|---|---|
parent | HTMLElement | the HTML element to insert the icon. |
iconId | string | the icon ID. |
Returns: void
Example:
setIcon(document.body, 'dice');Links to this page: