SVG icons

Svg Icons (via Iconify)

Edge has an official integration for rendering icons using Iconify. Iconify has over 100 open-source icon sets you can reference using a unified API.

Installation

The Edge and Iconify integration is a plugin you must install from the npm packages registry.

npm i edge-iconify

The next step is to register the plugin with Edge.

import { Edge } from 'edge.js'
import { edgeIconify } from 'edge-iconify'
const edge = Edge.create()
/**
* Register the plugin
*/
edge.use(edgeIconify)

Installing Iconify bundles

Before you can render icons, you will have to install the Iconify icon bundles. Iconify provides various distribution bundles. However, the Edge integration works only with JSON collections.

Let's install and use the HeroIcons icon set.

npm i @iconify-json/heroicons
import { Edge } from 'edge.js'
import { edgeIconify, addCollection } from 'edge-iconify'
import { icons as heroIcons } from '@iconify-json/heroicons'
/**
* Add heroIcons collection
*/
addCollection(heroIcons)
const edge = Edge.create()
/**
* Register the plugin
*/
edge.use(edgeIconify)

Usage

Once the setup is completed, you can render icons using the @svg tag. The svg tag accepts the icon identifier and an optional set of attributes to define on the output SVG element.

@svg('heroicons:arrow-left-solid')

Output

<svg width="1em" height="1em" viewBox="0 0 24 24"><path fill="currentColor" fill-rule="evenodd" d="M11.03 3.97a.75.75 0 0 1 0 1.06l-6.22 6.22H21a.75.75 0 0 1 0 1.5H4.81l6.22 6.22a.75.75 0 1 1-1.06 1.06l-7.5-7.5a.75.75 0 0 1 0-1.06l7.5-7.5a.75.75 0 0 1 1.06 0Z" clip-rule="evenodd"></path></svg>

In the following example, we define custom width, height, and color for the icon.

@svg('heroicons:arrow-left-solid', {
width: 40,
height: 40,
color: 'purple'
})

Output

<svg width="40" height="40" viewBox="0 0 24 24" color="purple"><path fill="currentColor" fill-rule="evenodd" d="M11.03 3.97a.75.75 0 0 1 0 1.06l-6.22 6.22H21a.75.75 0 0 1 0 1.5H4.81l6.22 6.22a.75.75 0 1 1-1.06 1.06l-7.5-7.5a.75.75 0 0 1 0-1.06l7.5-7.5a.75.75 0 0 1 1.06 0Z" clip-rule="evenodd"></path></svg>

Inline rendering within markup

You can use the svg global helper to render the SVG icons alongside the raw text markup (without a line break).

<button> {{ svg('heroicons:archive-box') }} Delete post <button>

Finding the icon identifier

You can view the available icons from the Iconify icons set browser.

  • Start by selecting the icon set you are using.
  • Search for the icon you want to use.
  • Click and copy its identifier displayed next to the Icon preview.

Finding and installing icon bundles

Unfortunately, we have not seen a detailed installation guide on the Iconify website for their JSON collections. You can use the following table to reference the collections and their npm package name.

The following table is aggregated from the Iconify collections.json file.

Icon set Npm package
Material Symbols @iconify-json/material-symbols
Google Material Icons @iconify-json/ic
Material Design Icons @iconify-json/mdi
Phosphor @iconify-json/ph
Solar @iconify-json/solar
Tabler Icons @iconify-json/tabler
Remix Icon @iconify-json/ri
Bootstrap Icons @iconify-json/bi
Carbon @iconify-json/carbon
IconaMoon @iconify-json/iconamoon
IonIcons @iconify-json/ion
Unicons @iconify-json/uil
Teenyicons @iconify-json/teenyicons
MingCute Icon @iconify-json/mingcute
Clarity @iconify-json/clarity
Iconoir @iconify-json/iconoir
Majesticons @iconify-json/majesticons
Zondicons @iconify-json/zondicons
Ant Design Icons @iconify-json/ant-design
BoxIcons @iconify-json/bx
BoxIcons Solid @iconify-json/bxs
css.gg @iconify-json/gg
Octicons @iconify-json/octicon
CoreUI Free @iconify-json/cil
Lucide @iconify-json/lucide
Basil @iconify-json/basil
Pixelarticons @iconify-json/pixelarticons
System UIcons @iconify-json/system-uicons
coolicons @iconify-json/ci
Akar Icons @iconify-json/akar-icons
Memory Icons @iconify-json/memory
Typicons @iconify-json/typcn
Radix Icons @iconify-json/radix-icons
Element Plus @iconify-json/ep
Circum Icons @iconify-json/circum
Material Design Light @iconify-json/mdi-light
Feather Icon @iconify-json/fe
EOS Icons @iconify-json/eos-icons
Charm Icons @iconify-json/charm
Prime Icons @iconify-json/prime
Humbleicons @iconify-json/humbleicons
uiw icons @iconify-json/uiw
Unicons Monochrome @iconify-json/uim
Unicons Thin Line @iconify-json/uit
Unicons Solid @iconify-json/uis
Maki @iconify-json/maki
Gridicons @iconify-json/gridicons
Mono Icons @iconify-json/mi
Quill Icons @iconify-json/quill
Gala Icons @iconify-json/gala
Fluent UI System Icons @iconify-json/fluent
IconPark Outline @iconify-json/icon-park-outline
IconPark Solid @iconify-json/icon-park-solid
IconPark TwoTone @iconify-json/icon-park-twotone
IconPark @iconify-json/icon-park
VSCode Icons @iconify-json/vscode-icons
Jam Icons @iconify-json/jam
HeroIcons @iconify-json/heroicons
Codicons @iconify-json/codicon
Gitlab SVGs @iconify-json/pajamas
Pepicons Pop! @iconify-json/pepicons-pop
Pepicons Print @iconify-json/pepicons-print
Pepicons Pencil @iconify-json/pepicons-pencil
Bytesize Icons @iconify-json/bytesize
Evil Icons @iconify-json/ei
Streamline @iconify-json/streamline
Guidance @iconify-json/guidance
Font Awesome Solid @iconify-json/fa6-solid
Font Awesome Regular @iconify-json/fa6-regular
OOUI @iconify-json/ooui
Nimbus @iconify-json/nimbus
FormKit Icons @iconify-json/formkit
Material Line Icons @iconify-json/line-md
SVG Spinners @iconify-json/svg-spinners
OpenMoji @iconify-json/openmoji
Twitter Emoji @iconify-json/twemoji
Noto Emoji @iconify-json/noto
Fluent Emoji @iconify-json/fluent-emoji
Fluent Emoji Flat @iconify-json/fluent-emoji-flat
Fluent Emoji High Contrast @iconify-json/fluent-emoji-high-contrast
Noto Emoji (v1) @iconify-json/noto-v1
Emoji One (Colored) @iconify-json/emojione
Emoji One (Monotone) @iconify-json/emojione-monotone
Emoji One (v1) @iconify-json/emojione-v1
Firefox OS Emoji @iconify-json/fxemoji
Streamline Emojis @iconify-json/streamline-emojis
BoxIcons Logo @iconify-json/bxl
SVG Logos @iconify-json/logos
Simple Icons @iconify-json/simple-icons
CoreUI Brands @iconify-json/cib
Font Awesome Brands @iconify-json/fa6-brands
Nonicons @iconify-json/nonicons
Arcticons @iconify-json/arcticons
File Icons @iconify-json/file-icons
Devicon @iconify-json/devicon
Devicon Plain @iconify-json/devicon-plain
Skill Icons @iconify-json/skill-icons
Brandico @iconify-json/brandico
Entypo+ Social @iconify-json/entypo-social
Cryptocurrency Icons @iconify-json/cryptocurrency
Cryptocurrency Color Icons @iconify-json/cryptocurrency-color
Flag Icons @iconify-json/flag
Circle Flags @iconify-json/circle-flags
Flagpack @iconify-json/flagpack
CoreUI Flags @iconify-json/cif
Font-GIS @iconify-json/gis
Map Icons @iconify-json/map
GeoGlyphs @iconify-json/geo
Game Icons @iconify-json/game-icons
FontAudio @iconify-json/fad
Academicons @iconify-json/academicons
Weather Icons @iconify-json/wi
Health Icons @iconify-json/healthicons
Medical Icons @iconify-json/medical-icon
Covid Icons @iconify-json/covid
Line Awesome @iconify-json/la
Eva Icons @iconify-json/eva
Dashicons @iconify-json/dashicons
Flat Color Icons @iconify-json/flat-color-icons
Entypo+ @iconify-json/entypo
Foundation @iconify-json/foundation
Raphael @iconify-json/raphael
Icons8 Windows 10 Icons @iconify-json/icons8
Innowatio Font @iconify-json/iwwa
HeroIcons v1 Outline @iconify-json/heroicons-outline
HeroIcons v1 Solid @iconify-json/heroicons-solid
Font Awesome 5 Solid @iconify-json/fa-solid
Font Awesome 5 Regular @iconify-json/fa-regular
Font Awesome 5 Brands @iconify-json/fa-brands
Font Awesome 4 @iconify-json/fa
Fluent UI MDL2 @iconify-json/fluent-mdl2
Fontisto @iconify-json/fontisto
IcoMoon Free @iconify-json/icomoon-free
PrestaShop Icons @iconify-json/ps
Subway Icon Set @iconify-json/subway
Open Iconic @iconify-json/oi
Icons8 Windows 8 Icons @iconify-json/wpf
Simple line icons @iconify-json/simple-line-icons
Elegant @iconify-json/et
Elusive Icons @iconify-json/el
Vaadin Icons @iconify-json/vaadin
Grommet Icons @iconify-json/grommet-icons
WebHostingHub Glyphs @iconify-json/whh
SmartIcons Glyph @iconify-json/si-glyph
Material Design Iconic Font @iconify-json/zmdi
Ligature Symbols @iconify-json/ls
BPMN @iconify-json/bpmn
Flat UI Icons @iconify-json/flat-ui
Vesper Icons @iconify-json/vs
TopCoat Icons @iconify-json/topcoat
Icalicons @iconify-json/il
Web Symbols Liga @iconify-json/websymbol
Fontelico @iconify-json/fontelico
Feather Icons @iconify-json/feather
Mono Icons @iconify-json/mono-icons
Pepicons @iconify-json/pepicons