Gathering detailed insights and metrics for react-icons
Gathering detailed insights and metrics for react-icons
Gathering detailed insights and metrics for react-icons
Gathering detailed insights and metrics for react-icons
svg react icons of popular icon packs
npm install react-icons
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
11,688 Stars
678 Commits
754 Forks
53 Watching
13 Branches
108 Contributors
Updated on 27 Nov 2024
Minified
Minified + Gzipped
TypeScript (61.7%)
JavaScript (13.5%)
SCSS (10.15%)
Astro (9.56%)
HTML (3.13%)
CSS (1.39%)
Shell (0.57%)
Cumulative downloads
Total Downloads
Last day
-1.4%
482,610
Compared to previous day
Last week
3.8%
2,621,354
Compared to previous week
Last month
10.3%
10,836,386
Compared to previous month
Last year
31.6%
109,128,062
Compared to previous year
1
Include popular icons in your React projects easily with react-icons
, which utilizes ES6 imports that allows you to include only the icons that your project is using.
1yarn add react-icons 2# or 3npm install react-icons --save
example usage
1import { FaBeer } from "react-icons/fa"; 2 3function Question() { 4 return ( 5 <h3> 6 Lets go for a <FaBeer />? 7 </h3> 8 ); 9}
View the documentation for further usage examples and how to use icons from other packages. NOTE: each Icon package has it's own subfolder under react-icons
you import from.
For example, to use an icon from Material Design, your import would be: import { ICON_NAME } from 'react-icons/md';
Note This option has not had a new release for some time. More info https://github.com/react-icons/react-icons/issues/593
If your project grows in size, this option is available. This method has the trade-off that it takes a long time to install the package.
1yarn add @react-icons/all-files 2# or 3npm install @react-icons/all-files --save
example usage
1import { FaBeer } from "@react-icons/all-files/fa/FaBeer"; 2 3function Question() { 4 return ( 5 <h3> 6 Lets go for a <FaBeer />? 7 </h3> 8 ); 9}
You can add more icons by submitting pull requests or creating issues.
You can configure react-icons props using React Context API.
Requires React 16.3 or higher.
1import { IconContext } from "react-icons"; 2 3<IconContext.Provider value={{ color: "blue", className: "global-class-name" }}> 4 <div> 5 <FaFolder /> 6 </div> 7</IconContext.Provider>;
Key | Default | Notes |
---|---|---|
color | undefined (inherit) | |
size | 1em | |
className | undefined | |
style | undefined | Can overwrite size and color |
attr | undefined | Overwritten by other attributes |
title | undefined | Icon description for accessibility |
Import path has changed. You need to rewrite from the old style.
1// OLD IMPORT STYLE 2import FaBeer from "react-icons/lib/fa/beer"; 3 4function Question() { 5 return ( 6 <h3> 7 Lets go for a <FaBeer />? 8 </h3> 9 ); 10}
1// NEW IMPORT STYLE 2import { FaBeer } from "react-icons/fa"; 3 4function Question() { 5 return ( 6 <h3> 7 Lets go for a <FaBeer />? 8 </h3> 9 ); 10}
Ending up with a large JS bundle? Check out this issue.
From version 3, vertical-align: middle
is not automatically given. Please use IconContext to specify className or specify an inline style.
1<IconContext.Provider value={{ style: { verticalAlign: 'middle' } }}>
className
StylingComponent
1<IconContext.Provider value={{ className: 'react-icons' }}>
CSS
1.react-icons { 2 vertical-align: middle; 3}
Dependencies on @types/react-icons
can be deleted.
1yarn remove @types/react-icons
1npm remove @types/react-icons
./build-script.sh
will build the whole project. See also CI scripts for more information.
1yarn 2cd packages/react-icons 3yarn fetch # fetch icon sources 4yarn build
First, check the discussion to see if anyone would like to add an icon set.
https://github.com/react-icons/react-icons/discussions/categories/new-icon-set
The SVG files to be fetched are managed in this file. Edit this file and run yarn fetch && yarn check && yarn build
.
https://github.com/react-icons/react-icons/blob/master/packages/react-icons/src/icons/index.ts
Note The project is not actively accepting PR for the preview site at this time.
The preview site is the react-icons
website, built in Astro+React.
1cd packages/react-icons 2yarn fetch 3yarn build 4 5cd ../preview-astro 6yarn start
The demo is a Create React App boilerplate with react-icons
added as a dependency for easy testing.
1cd packages/react-icons 2yarn fetch 3yarn build 4 5cd ../demo 6yarn start
SVG is supported by all major browsers. With react-icons
, you can serve only the needed icons instead of one big font file to the users, helping you to recognize which icons are used in your project.
MIT
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
3 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
Reason
Found 3/24 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
19 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More