Feather is a collection of simply beautiful open source icons. Each icon is designed on a 24x24 grid with an emphasis on simplicity, consistency, and flexibility. Show https://feathericons.com npm install feather-icons Table of ContentsQuick StartStart with this CodePen Template to begin prototyping with Feather in the browser. Or copy and paste the following code snippet into a blank npm install feather-icons --save4 file. <!DOCTYPE html> <html lang="en"> <title></title> <script src="https://unpkg.com/feather-icons"></script> <body> <!-- example icon --> <i data-feather="circle"></i> <script> feather.replace() </script> </body> </html> UsageAt its core, Feather is a collection of files. This means that you can use Feather icons in all the same ways you can use SVGs (e.g. npm install feather-icons --save5, npm install feather-icons --save6, npm install feather-icons --save7, npm install feather-icons --save8, npm install feather-icons --save9, <script src="path/to/dist/feather.js"></script>0). Here's a helpful article detailing the many ways SVGs can be used on the web: The following are additional ways you can use Feather. Client-side JavaScript1. Install
Install with npm. npm install feather-icons --save Or just copy <script src="path/to/dist/feather.js"></script>1 or <script src="path/to/dist/feather.js"></script>2 into your project directory. You don't need both <script src="path/to/dist/feather.js"></script>1 and <script src="path/to/dist/feather.js"></script>2. 2. IncludeInclude <script src="path/to/dist/feather.js"></script>1 or <script src="path/to/dist/feather.js"></script>2 with a <script src="path/to/dist/feather.js"></script>7 tag: <script src="path/to/dist/feather.js"></script>
Or load the script from a CDN provider: <!-- choose one --> <script src="https://unpkg.com/feather-icons"></script> <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> After including the script, <!-- choose one --> <script src="https://unpkg.com/feather-icons"></script> <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>1 will be available as a global variable. 3. UseTo use an icon on your page, add a <!-- choose one --> <script src="https://unpkg.com/feather-icons"></script> <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>2 attribute with the icon name to an element: <i data-feather="circle"></i> See the complete list of icons at feathericons.com. 4. ReplaceCall the npm install feather-icons --save2 method: <script> feather.replace() </script> All elements that have a <!-- choose one --> <script src="https://unpkg.com/feather-icons"></script> <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>2 attribute will be replaced with SVG markup corresponding to their <!-- choose one --> <script src="https://unpkg.com/feather-icons"></script> <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>2 attribute value. See the for more information about npm install feather-icons --save2. Node1. InstallInstall with npm: npm install feather-icons --save 2. Requireconst feather = require('feather-icons') 3. Usefeather.icons.x // { // name: 'x', // contents: '<line ... /><line ... />`, // tags: ['cancel', 'close', 'delete', 'remove'], // attrs: { // class: 'feather feather-x', // xmlns: 'http://www.w3.org/2000/svg', // width: 24, // height: 24, // viewBox: '0 0 24 24', // fill: 'none', // stroke: 'currentColor', // 'stroke-width': 2, // 'stroke-linecap': 'round', // 'stroke-linejoin': 'round', // }, // toSvg: [Function], // } feather.icons.x.toSvg() // <svg class="feather feather-x" ...><line ... /><line ... /></svg> feather.icons.x.toSvg({ class: 'foo bar', 'stroke-width': 1, color: 'red' }) // <svg class="feather feather-x foo bar" stroke-width="1" color="red" ...><line ... /><line ... /></svg> See the for more information about the available properties and methods of the <!-- choose one --> <script src="https://unpkg.com/feather-icons"></script> <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>1 object. SVG Sprite1. Install
Install with npm. npm install feather-icons --save Or just copy <!-- choose one --> <script src="https://unpkg.com/feather-icons"></script> <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>8 into your project directory. 2. UseInclude an icon on your page with the following markup: <!DOCTYPE html> <html lang="en"> <title></title> <script src="https://unpkg.com/feather-icons"></script> <body> <!-- example icon --> <i data-feather="circle"></i> <script> feather.replace() </script> </body> </html>1
However, this markup can be simplified using a simple CSS class to avoid repetition of SVG attributes between icons: <!DOCTYPE html> <html lang="en"> <title></title> <script src="https://unpkg.com/feather-icons"></script> <body> <!-- example icon --> <i data-feather="circle"></i> <script> feather.replace() </script> </body> </html>2 <!DOCTYPE html> <html lang="en"> <title></title> <script src="https://unpkg.com/feather-icons"></script> <body> <!-- example icon --> <i data-feather="circle"></i> <script> feather.replace() </script> </body> </html>3 FigmaFeather is available as a Figma component library. To use the components, log in to your Figma account and duplicate the file to your drafts. API Referencenpm install feather-icons --save0An object with data about every icon. Usage<!DOCTYPE html> <html lang="en"> <title></title> <script src="https://unpkg.com/feather-icons"></script> <body> <!-- example icon --> <i data-feather="circle"></i> <script> feather.replace() </script> </body> </html>4
View Source <i data-feather="circle"></i>5Returns an SVG string. ParametersNameTypeDescription<i data-feather="circle"></i>6 (optional)ObjectKey-value pairs in the <i data-feather="circle"></i>6 object will be mapped to HTML attributes on the <i data-feather="circle"></i>8 tag (e.g. <i data-feather="circle"></i>9 maps to <script> feather.replace() </script>0). All default attributes on the <i data-feather="circle"></i>8 tag can be overridden with the <i data-feather="circle"></i>6 object.
Usage<!DOCTYPE html> <html lang="en"> <title></title> <script src="https://unpkg.com/feather-icons"></script> <body> <!-- example icon --> <i data-feather="circle"></i> <script> feather.replace() </script> </body> </html>5 View Source <script> feather.replace() </script>9Replaces all elements that have a <!-- choose one --> <script src="https://unpkg.com/feather-icons"></script> <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>2 attribute with SVG markup corresponding to the element's <!-- choose one --> <script src="https://unpkg.com/feather-icons"></script> <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>2 attribute value. |