Skip to content

Individual icon sets

For developer's convenience, full icon sets package is also available as smaller packages, one package per icon set.

Packages

Packages are published as @iconify-json/{prefix}, where "{prefix}" is icon set prefix.

These packages are available only on NPM. They are automatically generated from big icon sets package whenever it is updated.

Contents

Unlike full package, where all data for icon set is stored in one file, individual icon sets split data in several files, so you can load only data you need:

  • icons.json contains icon set in IconifyJSON format, without any metadata.
  • info.json contains icon set information in IconifyInfo format.
  • chars.json contains characters map, if exists in IconifyChars format. File might not exist in some icon sets.
  • metadata.json contains metadata in IconifyMetaData format: categories, themes. File might not exist in some icon sets.

You can import icon set using named import from package, like this:

jsimport { icons as mdiIcons } from "@iconify-json/mdi";
import { icons as mdiLightIcons } from "@iconify-json/mdi-light";

Code samples above use JSON modules. It works fine when using bundlers or when using CommonJS. When using ES modules, older versions of Node.js require running script with "--experimental-json-modules" flag.

If you are using older Node.js and cannot import JSON files, you can use require():

jsconst mdiIcons = require("@iconify-json/mdi/icons.json");
const mdiLightIcons = require("@iconify-json/mdi-light/icons.json");

Creating packages

If you want to create a package for your icon set, see exportJSONPackage() of Iconify Tools.

Difference from big icon sets package

In big icon sets package, all JSON files contain an entire icon set: icon data, information, metadata (categories, themes), characters map.

In small packages that data is split into several files, as described above. If you only want icon data, it is better to read icons.json from multiple small packages because they are smaller.

Icon sets list

If you need to get list of available open source icon sets, see icon sets list package.

Reading data

For reading icon sets, you can use:

To use icon set packages with Iconify Utils, follow these steps:

  • Read icons data. If you are using file system functions that return a string, convert it to IconifyJSON object using JSON.parse().
  • Extract data. To extract multiple icons, use getIcons(), to extract one icon use getIconData(). Click function links for code samples.

Released under the Apache 2.0 License.