DEV Community

Tadea Simunovic
Tadea Simunovic

Posted on

2 1

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

AWS Q Developer image

Your AI Code Assistant

Ask anything about your entire project, code and get answers and even architecture diagrams. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Start free in your IDE

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay