
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
react-icons2
Advanced tools
Include popular icons in your React projects easly with react-icons, which utilizes ES6 imports that allows you to include only the icons that your project is using.
npm install react-icons --save
import FaBeer from 'react-icons/lib/fa/beer';
class Question extends React.Component {
render() {
return <h3> Lets go for a <FaBeer />? </h3>
}
}
If you are not using es6 compiler like babel or rollup.js, it's possible to include icons from the compiled folder ./lib. Babel by default will ignore node_modules so if you don't want to change the settings you will need to use files from ./lib
var FaBeer = require('react-icons/lib/fa/beer');
var Question = React.createClass({
render: function() {
return React.createElement('h3', null,
' Lets go for a ', React.createElement(FaBeer, null), '? '
);
}
});
You can include icons directly from react-icons using import FaBeer from 'react-icons', but you should wait to Webpack 2 implement dead code elimination based on es6 imports.
Also it's possible to include the whole icon pack from:
import * as FontAwesome from 'react-icons/lib/fa'
class Question extends React.Component {
render() {
return <h3> Lets go for a <FontAwesome.FaBeer />? </h3>
}
}
or import multiple icons from the same pack
import {MdCancel, MdChat, MdCheck} from 'react-icons/md';
every icon pack is in their own folder
to view all icons visit docs
Also, to view and search for the necessary icons you can use the tool Icon Viewer.
Currently supported icons are:
You can add more icons by submitting pull requests or creating issues.
You can configure react-icons props in context.
class HigherOrderComponent extends Component {
static childContextTypes = {
reactIconBase: PropTypes.object
};
getChildContext() {
return {
reactIconBase: {
color: 'tomato',
size: 24,
style: {
...
}
}
}
}
render() {
...
}
}
Context is overriden inline.
<Icon size={30} color='aliceblue' style={{ ... }} />
Just add svg icons in ./icons/:icons-name folder and create pull request again develop after merge I will generate React components because this process is not fully automated yet.
Svg is supported by all major browsers.
With react-icons, you can send icons that are specified instead of one big font file to the users, helping you to recognize which icons are used in your project.
create-react-app?create-react-app tries to load the icons as files by default, rather than running through Babel. You may therefore see an erorr message similar to "You may need an appropriate loader...". The recommended workaround is to import from lib instead:
import FaBeer from 'react-icons/lib/fa/beer';
MIT
FAQs
svg react icons of popular icon packs using ES6 imports
We found that react-icons2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.