getIcon
Official
Create an SVG from an iconId. Returns null if no icon associated with the iconId.
Import:
import { getIcon } from 'obsidian';Signature:
function getIcon(iconId: string): null | SVGSVGElementParameters:
| Parameter | Type | Description |
|---|---|---|
iconId |
string | the icon ID. |
Returns: null | SVGSVGElement — the SVG element or null if no icon associated with the iconId.
Example:
console.log(getIcon('dice')); // <svg>...</svg>Links to this page: