Iconify icon sets package

There are several packages available that contain all icons, see icon sets documentation.

This article describes full icons package.

You can get the latest version of package from the following sources:

Files in big package

Icon sets package contains the following files:

  • collections.json contains list of available icon sets. It is a simple object, where key is prefix, value is information about icon set in IconifyInfo format.
  • collections.md contains the same information as collections.json, but in easily readable format.
  • json/ directory contains JSON files for each icon set in IconifyJSON format, such as json/mdi.json.
  • lib/ and dist/ directories contain simple helper functions for PHP and Node.js. See below.

Icon set files contain all icon set data, including info and metadata. If you want to get minimal version without extra stuff, use small packages instead.

Maintenance

Package is automatically updated every few days, so it always includes the latest icons. If you want to use the latest icons, all you have to do is keep dependencies in your project up to date.

If you are using Iconify API, you do not need to do anything because changes are automatically pushed to API servers within minutes after being published.

Reading data

For reading icon sets, you can use:

Helper functions

Package contains simple helper functions for Node.js and PHP.

Node.js functions for version 1

Versions 1 of @iconify/json contain synchronous functions:

  • collections() returns list of collections. It is a simple object, where key is prefix, value is information about icon set in LegacyIconifyInfo format.
  • locate(prefix) returns location of JSON file for an icon set.

Node.js functions for version 2

In versions 2 of @iconify/json functions are asynchronous:

  • lookupCollections() returns list of collections. It is a simple object, where key is prefix, value is information about icon set in IconifyInfo format.
  • lookupCollection(prefix) loads an icon set. Result is IconifyJSON object.

All functions listed above are asynchronous and require using await before function name (see example below).

There are also few synchronous functions:

  • locate(prefix) returns location of JSON file for an icon set.

PHP functions

PHP is a synchronous language, so functions for PHP are identical for versions 1 and 2.

Use Iconify\IconsJSON\Finder class that has the following static functions:

  • collections() returns list of collections. It is a simple object, where key is prefix, value is information about icon set. For version 1 data is in LegacyIconifyInfo format, for version 2 data is in IconifyInfo format.
  • locate(prefix) returns location of JSON file for an icon set.
  • rootDir() returns location of root directory of package.

Example

Example:

Node.js (for version 2.x)
// Installation: npm install --save @iconify/json
import { lookupCollections, locate } from '@iconify/json';

(async () => {
   // Get list of all icon sets
   const iconSets = await lookupCollections();
   const prefixes = Object.keys(iconSets);
   console.log(`Available ${prefixes.length} icon sets`);

   // List icon sets in format: "prefix: name (total icons)"
   console.log(
       prefixes
           .map((prefix) => {
               const item = iconSets[prefix];
               // prefix: name (total icons)
               return prefix + ': ' + item.name + ' (' + item.total + ' icons)';
           })
           .join('\n')
   );

   // Get location of Taber Icons JSON file
   const tabler = locate('tabler');
   console.log('Tabler icons JSON file is located at:', tabler);
})();
Node.js (for version 1.x)
// Installation: npm install --save @iconify/json
const icons = require('@iconify/json');

// Get list of all icon sets
const iconSets = icons.collections();
const prefixes = Object.keys(iconSets);
console.log(`Available ${prefixes.length} icon sets`);

// List icon sets in format: "prefix: name (total icons)"
console.log(
   prefixes
       .map((prefix) => {
           const item = iconSets[prefix];
           // prefix: name (total icons)
           return prefix + ': ' + item.name + ' (' + item.total + ' icons)';
       })
       .join('\n')
);

// Get location of Taber Icons JSON file
const tabler = icons.locate('tabler');
console.log('Tabler icons JSON file is located at:', tabler);
PHP
<?php
require './vendor/autoload.php';

// Installation: composer require iconify/json
use Iconify\IconsJSON\Finder;

// Get list of all icon sets
$iconSets = Finder::collections();
$prefixes = array_keys($iconSets);
echo 'Available ', count($prefixes), " icon sets\n";

// List icon sets in format: "prefix: name (total icons)"
echo implode("\n", array_map(function ($prefix) use ($iconSets) {
   $item = $iconSets[$prefix];
   return $prefix . ': ' . $item['name'] . ' (' . $item['total'] . ' icons)';
}, $prefixes)), "\n";

// Get location of Taber Icons JSON file
$tabler = Finder::locate('tabler');
echo 'Tabler icons JSON file is located at: ', $tabler, "\n";

These helper functions only list and locate icon sets.

For reading icon sets, you can use Iconify Utils or Iconify JSON Tools.

Adding icon sets

Do you know a good open source icon set that is missing in Iconify icon sets? Open an issue on GitHub to request to add it to Iconify icon sets.

Licences

All icon sets available in Iconify collections are released under free or open source licence, which allows redistribution. See each icon set's information block for details.