Iconify icon sets in JSON format
This is collection of SVG icons created by various authors, released under various free licenses. Some collections require attribution when used for commercial purposes. See collections.md for list of collections and their licenses.
All icons have been normalized:
- Cleaned up, removing anything that is not needed to show icon.
- Colors for monotone icons have been replaced with
currentColor
, making it easy to change icon color by changing text color. - Icon content has been optimised to reduce its size.
Repository is updated 3 times a week by fully automated script, so it always contains latest icons from various sources.
Format and usage
Icon sets are stored in IconifyJSON
format. TypeScript definition is available in @iconify/types
package. Documentation is available on Iconify Documentation website.
To work with icon sets, use Iconify Utils. Utils package works in any JavaScript environment: Node.js, Deno, browsers, isolated JavaScript environments. For PHP applications use Iconify JSON Tools.
To create icon sets, use Iconify Tools. Tools package works in Node.js, it can import icons from various sources, do cleanup, optimisation, export it in IconifyJSON
format and generate NPM packages.
How to get this repository
Instructions below are for Node.js and PHP projects.
Node.js
Run this command to add icons to your project:
npm install --save @iconify/json
Icons will be available in node_modules/@iconify/json
To resolve filename for any json file, use this if you are using CommonJS syntax:
import { locate } from '@iconify/json';
// returns location of mdi-light.json
const mdiLightFilename = locate('mdi-light');
PHP
Install and initialize Composer project. See documentation at https://getcomposer.org
Then open composer.json and add following code:
"require": {
"php": ">=5.6",
"iconify/json": "*"
}
then run:
composer install
Icons will be available in vendor/iconify/json/
If you don't use Composer, clone GitHub repository and add necessary autoload code.
To resolve filename for any json file, use this:
// Returns location of mdi-light.json
$mdiLightLocation = \Iconify\IconsJSON\Finder::locate('mdi-light');
Data format
Icons used by Iconify are in directory json, in Iconify JSON format.
Why JSON instead of SVG? There are several reasons for that:
- Easy to store images in bulk.
- Contains only content of icon without SVG element, making it easy to manipulate content without doing complex parsing. It also makes it easier to create components, such as React icon component, allowing to use framework native SVG element.
- Data can contain additional content: aliases for icons, icon set information, categories/tags/themes.
Why not XML?
- JSON is much easier to parse without additional tools. All languages support it.
Format of json file is very simple:
", "width": 24, "height": 24 } }, "aliases": { "icon-alias": { "parent": "icon-name" } } }">{ "prefix": "mdi-light", "icons": { "icon-name": { "body": "", "width": 24, "height": 24 } }, "aliases": { "icon-alias": { "parent": "icon-name" } } }