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