Skip to content

SVG framework function: buildIcon

This tutorial is part of Iconify SVG Framework functions tutorial.

Function buildIcon() generates data used by renderSVG() and renderHTML() functions.

This function is meant to be used when you generate <svg> code.


The function has the following parameters:

  • icon, IconifyIcon. Icon data.
  • customisations. Optional customizations object.

The function returns object containing icon data, null if icon is not available.

You need icon data before you can use this function. See getIcon(), iconExists() and loadIcon() functions.


See renderIcon() function.

Difference from renderIcon

This function is almost identical to renderIcon() with one difference: first parameter is icon data, not icon name.

Why are there two functions? For compatibility with other icon components and with old versions of SVG framework. Other components export only buildIcon(), SVG framework had renderIcon() from old version. Internally, renderIcon() uses same code as buildIcon(), so having both does not increase bundle size by much.

Released under the Apache 2.0 License.