use-svg
The best tool to work with SVGs icons
Current version: 0.0.7
Install & basic usage
npm install use-svg
How to use
You can use package's default icons, your custom ones or combination of them.
To include default icons
Just before the end of the closing <body>
tag you have to include the default-icons and the script file:
To include your custom icons
If you wants to add any custom svg icon to the icons list you first copy the d
attribute from the path
Important to note that the viewBox for your icon should be 24*24
Then add it with icons name to an object and name it icons
To use the icon
Simply as the ordinary way using <use>
tag and but in the xlink:href
attribute the icon names
...
...
Methods
Method | Arguments | Description |
---|---|---|
start |
Initializes | |
add |
element: html or DOM object | To render SVG icons only in specific section |
I'm currently add more icons to this package