Add React Icons To Your Projects

tadea

Tadea Simunovic

Posted on July 13, 2020

Add React Icons To Your Projects

In this post, you will learn how to use icons from popular icons sets in your React applications. React Icons provides thousands of free, open-source icons. It includes ten popular open-source icon libraries, including Font Awesome, Bootstrap Icons, Devicons, Game Icons, Material Design, ect. It utilizes ES6 imports that allow you to include only the icons that your project is using.

Add icons to your project

#add with npm
npm install react-icons --save

#add with yarn
yarn add react-icons
Enter fullscreen mode Exit fullscreen mode

If you open React Icons documenation, you will see on left-hand side open-source libraries you can use with React Icons.
Alt Text
Also, you can search icons by name in a search bar. For example...
Alt Text
Once you click on the icon you will be able to copy/paste into your project. In your code editor, you will import icons. In this case I will be using Font Awesome Icon.

import { FaBalanceScale } from "react-icons/fa";
Enter fullscreen mode Exit fullscreen mode

Withing div tag in your component you will simply invoke it.

<div>
   <FaBalanceScale />
</div>
Enter fullscreen mode Exit fullscreen mode

How simple is that! Here is how does it look in a browser.
Alt Text

💖 💪 🙅 🚩
tadea
Tadea Simunovic

Posted on July 13, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related