There are three ways to use any icon on SVGBox.
You can directly link to any icon by using query params 'ic' and 'color'. The link is of this format:
https://s2.svgbox.net/$ICONSET.svg?color=$COLOR&ic=$ICON
Say you want to use the heart icon from the hero solid iconset. Then, the code you'll use will be:
Here, I am requesting the heart icon by specifying it in 'ic' param and customizing the color using an HTML5 color name (see all the colors you can use).
Using icons as images is the simplest approach and is a good fit for many scenarios, but it has its drawbacks. You can't modify color on hover, or use CSS variables, and the color can't be inherited from the parent element (currentColor).
svg-loader solves this issue by requesting icon data via XHRs and creating inline SVG objects.
To use an icon via svg-loader, you must add the script to your code. Then, render the icon using data-src attribute. Example:
You can also just copy the SVG code and use it directly in your project.
You can modify the color by the color query parameter. The parameter supports multiple color formats: