Skip to main content
Registers icon packs for use in Mermaid diagrams. This allows you to use icons from various icon libraries (like Font Awesome, Material Icons, etc.) within your diagrams.

Signature

Parameters

IconLoader[]
required
Array of icon loader definitions. Each loader can be either synchronous (with icons provided directly) or asynchronous (with a loader function).

Return value

void - This method does not return a value.

Throws

  • Throws an error if an icon loader doesn’t have a name property
  • Throws an error if an icon loader has neither icons nor loader property

Examples

Synchronous icon pack

Asynchronous icon pack

Multiple icon packs

Using icons in diagrams

Loading from NPM packages

Creating a reusable icon pack module

Error handling

Icon reference format

When using registered icons in diagrams, reference them as:
Where:
  • prefix is the icon pack name
  • iconName is the icon identifier within that pack
Examples:
  • @icon:fa:home - Home icon from Font Awesome
  • @icon:mdi:account - Account icon from Material Design Icons
  • @icon:custom:logo - Custom logo icon

Iconify JSON format

Icon data must follow the Iconify JSON format:

Usage notes

  • Icon packs must be registered before rendering diagrams that use them
  • Async loaders only fetch data when an icon from that pack is first used
  • Icon names are case-sensitive
  • The name field must be unique across all registered icon packs
  • Icons are rendered as SVG and inherit diagram styling where applicable
  • If an icon is not found, a fallback “unknown” icon (question mark) is displayed