Top Related Projects
Simply beautiful open-source icons
The iconic SVG, font, and CSS toolkit
Premium hand-crafted icons built by Ionic, for Ionic apps and web apps everywhere 🌎
A scalable set of icons handcrafted with <3 by GitHub
SVG icons for popular brands
A set of over 5800 free MIT-licensed high-quality SVG icons for you to use in your web projects.
Quick Overview
React Icons is a popular library that provides a comprehensive collection of icon sets for use in React applications. It includes icons from various popular icon libraries such as Font Awesome, Material Design, and Ionicons, allowing developers to easily incorporate a wide range of icons into their React projects.
Pros
- Large selection of icon sets from multiple popular libraries
- Easy to use with a simple import syntax
- Customizable icon properties (size, color, etc.)
- Reduces bundle size by allowing import of individual icons
Cons
- Can increase bundle size if many icons are imported
- Some icon sets may have inconsistent styling
- Limited built-in animation options
- Occasional delays in updating to the latest versions of source icon libraries
Code Examples
- Importing and using a single icon:
import { FaReact } from "react-icons/fa";
function App() {
return <FaReact size={32} color="blue" />;
}
- Using icons with custom styling:
import { MdHome } from "react-icons/md";
function NavItem() {
return (
<div className="nav-item">
<MdHome className="icon" style={{ marginRight: '10px' }} />
Home
</div>
);
}
- Creating an icon button component:
import { IconContext } from "react-icons";
import { FiSend } from "react-icons/fi";
function IconButton({ onClick }) {
return (
<IconContext.Provider value={{ className: "icon-button" }}>
<button onClick={onClick}>
<FiSend />
Send
</button>
</IconContext.Provider>
);
}
Getting Started
To use React Icons in your project, follow these steps:
- Install the package:
npm install react-icons
- Import and use icons in your React components:
import { FaGithub } from "react-icons/fa";
function App() {
return (
<div>
<h1>Welcome to my app!</h1>
<FaGithub size={24} />
</div>
);
}
- Optionally, use the IconContext for global icon styling:
import { IconContext } from "react-icons";
function App() {
return (
<IconContext.Provider value={{ color: "blue", size: "2em" }}>
{/* Your app components */}
</IconContext.Provider>
);
}
Competitor Comparisons
Simply beautiful open-source icons
Pros of Feather
- Lightweight and minimalist design, offering a consistent and clean aesthetic
- SVG-based icons, allowing for easy customization and scaling
- Smaller package size, potentially improving load times
Cons of Feather
- Limited icon set compared to React Icons (fewer options)
- Less frequent updates and additions to the icon library
- May require additional setup for React integration
Code Comparison
React Icons:
import { FaHome } from 'react-icons/fa';
function App() {
return <FaHome />;
}
Feather:
import { Home } from 'react-feather';
function App() {
return <Home />;
}
Summary
React Icons offers a vast collection of icons from multiple libraries, making it a versatile choice for projects requiring diverse icon styles. It's easy to use in React applications but may have a larger package size.
Feather provides a curated set of simple, elegant icons with a consistent style. It's lightweight and SVG-based, offering better performance and customization options. However, it has a more limited selection and may require additional setup for React projects.
Choose React Icons for variety and ease of use in React, or Feather for a minimalist, performance-focused approach with consistent design.
The iconic SVG, font, and CSS toolkit
Pros of Font-Awesome
- Extensive library with over 7,000 icons
- Supports both free and paid (Pro) versions with additional icons
- Offers CSS-based styling and customization options
Cons of Font-Awesome
- Larger file size, potentially impacting load times
- Requires additional setup for React projects
- May include unnecessary icons, increasing bundle size
Code Comparison
Font-Awesome (with React):
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faUser } from '@fortawesome/free-solid-svg-icons'
const MyComponent = () => (
<FontAwesomeIcon icon={faUser} />
)
React-Icons:
import { FaUser } from 'react-icons/fa'
const MyComponent = () => (
<FaUser />
)
Summary
Font-Awesome offers a vast icon library with extensive customization options, making it suitable for various projects. However, it may require additional setup for React and can increase bundle size. React-Icons, on the other hand, provides a more straightforward integration for React projects with a smaller footprint, but may have a more limited icon selection compared to Font-Awesome's extensive library.
Premium hand-crafted icons built by Ionic, for Ionic apps and web apps everywhere 🌎
Pros of Ionicons
- Designed specifically for Ionic Framework, ensuring seamless integration with Ionic projects
- Includes both iOS and Material Design style icons, providing flexibility for different platforms
- Offers SVG icons, which are scalable and customizable
Cons of Ionicons
- Limited to Ionic-specific icons, which may not cover all use cases
- Requires additional setup for non-Ionic projects
- Smaller icon set compared to React Icons
Code Comparison
Ionicons usage:
import { IonIcon } from '@ionic/react';
import { heart } from 'ionicons/icons';
<IonIcon icon={heart} />
React Icons usage:
import { FaHeart } from 'react-icons/fa';
<FaHeart />
Summary
Ionicons is tailored for Ionic Framework projects, offering platform-specific designs and SVG icons. However, it has a more limited icon set and may require additional setup for non-Ionic projects. React Icons, on the other hand, provides a wider variety of icon sets from different libraries, making it more versatile for general React projects. The choice between the two depends on the specific project requirements and the development framework being used.
A scalable set of icons handcrafted with <3 by GitHub
Pros of Octicons
- Designed specifically for GitHub's UI, ensuring consistency with GitHub's ecosystem
- Includes SVG and JavaScript versions of icons, offering flexibility in implementation
- Provides a well-documented API for customizing icons
Cons of Octicons
- Limited icon set compared to React Icons, focusing primarily on GitHub-related icons
- May require additional setup for use in React projects, as it's not specifically designed for React
Code Comparison
React Icons:
import { FaGithub } from 'react-icons/fa';
const GitHubIcon = () => <FaGithub />;
Octicons:
import { GitHubIcon } from '@primer/octicons-react';
const GitHubIconComponent = () => <GitHubIcon size={24} />;
Summary
React Icons offers a vast collection of icons from various popular icon sets, making it a versatile choice for many projects. It's particularly easy to use in React applications.
Octicons, while more limited in scope, provides a cohesive set of icons specifically designed for GitHub-related projects. It offers both SVG and JavaScript versions, giving developers more flexibility in how they implement the icons.
The choice between the two depends on the project's needs. For GitHub-centric projects or those aiming for consistency with GitHub's design language, Octicons is ideal. For projects requiring a wider variety of icons or simpler React integration, React Icons may be the better choice.
SVG icons for popular brands
Pros of Simple Icons
- Lightweight and focused solely on brand/logo icons
- SVG-based, allowing for easy customization and scaling
- Extensive collection of over 2,000 brand icons
Cons of Simple Icons
- Limited to brand/logo icons only, lacking general-purpose icons
- Requires manual implementation for React projects
- No built-in React components or easy integration
Code Comparison
Simple Icons usage:
<img src="https://cdn.jsdelivr.net/npm/simple-icons@v5/icons/github.svg" alt="GitHub" />
React Icons usage:
import { FaGithub } from 'react-icons/fa';
function App() {
return <FaGithub />;
}
Key Differences
- React Icons provides a wide variety of icon sets, including general-purpose icons, while Simple Icons focuses solely on brand/logo icons
- React Icons offers ready-to-use React components, making integration easier for React projects
- Simple Icons provides SVG files, allowing for more flexibility in usage across different platforms and frameworks
- React Icons has a larger overall collection of icons, but Simple Icons has a more extensive brand/logo icon library
Use Cases
- Choose Simple Icons for projects requiring a wide range of brand/logo icons with flexibility in implementation
- Opt for React Icons in React projects needing diverse icon sets and easy integration
A set of over 5800 free MIT-licensed high-quality SVG icons for you to use in your web projects.
Pros of Tabler Icons
- Offers a consistent, modern design aesthetic across all icons
- Provides SVG and React versions of icons, allowing for more flexibility
- Includes a wider variety of icon categories, such as brand logos and flags
Cons of Tabler Icons
- Has a smaller total number of icons compared to React Icons
- Less frequently updated and maintained than React Icons
- May require more setup and configuration for use in React projects
Code Comparison
React Icons:
import { FaHome } from 'react-icons/fa';
function App() {
return <FaHome />;
}
Tabler Icons:
import { IconHome } from '@tabler/icons-react';
function App() {
return <IconHome />;
}
Both libraries offer simple import and usage patterns, with React Icons using a more specific naming convention (e.g., Fa
prefix for Font Awesome icons) and Tabler Icons using a more generic Icon
prefix.
React Icons provides a wider range of icon sets from various popular libraries, while Tabler Icons offers a more cohesive and consistent design language across its icon set. The choice between the two depends on specific project requirements, design preferences, and the need for variety versus consistency in icon styles.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
React Icons
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.
Installation (for standard modern project)
yarn add react-icons
# or
npm install react-icons --save
example usage
import { FaBeer } from "react-icons/fa";
function Question() {
return (
<h3>
Lets go for a <FaBeer />?
</h3>
);
}
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';
Installation (for meteorjs, gatsbyjs, etc)
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.
yarn add @react-icons/all-files
# or
npm install @react-icons/all-files --save
example usage
import { FaBeer } from "@react-icons/all-files/fa/FaBeer";
function Question() {
return (
<h3>
Lets go for a <FaBeer />?
</h3>
);
}
Icons
You can add more icons by submitting pull requests or creating issues.
Configuration
You can configure react-icons props using React Context API.
Requires React 16.3 or higher.
import { IconContext } from "react-icons";
<IconContext.Provider value={{ color: "blue", className: "global-class-name" }}>
<div>
<FaFolder />
</div>
</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 |
Migrating from version 2 -> 3
Change import style
Import path has changed. You need to rewrite from the old style.
// OLD IMPORT STYLE
import FaBeer from "react-icons/lib/fa/beer";
function Question() {
return (
<h3>
Lets go for a <FaBeer />?
</h3>
);
}
// NEW IMPORT STYLE
import { FaBeer } from "react-icons/fa";
function Question() {
return (
<h3>
Lets go for a <FaBeer />?
</h3>
);
}
Ending up with a large JS bundle? Check out this issue.
Adjustment CSS
From version 3, vertical-align: middle
is not automatically given. Please use IconContext to specify className or specify an inline style.
Global Inline Styling
<IconContext.Provider value={{ style: { verticalAlign: 'middle' } }}>
Global className
Styling
Component
<IconContext.Provider value={{ className: 'react-icons' }}>
CSS
.react-icons {
vertical-align: middle;
}
TypeScript native support
Dependencies on @types/react-icons
can be deleted.
Yarn
yarn remove @types/react-icons
NPM
npm remove @types/react-icons
Contributing
./build-script.sh
will build the whole project. See also CI scripts for more information.
Development
yarn
cd packages/react-icons
yarn fetch # fetch icon sources
yarn build
Add/Update icon set
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
Preview
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.
cd packages/react-icons
yarn fetch
yarn build
cd ../preview-astro
yarn start
Demo
The demo is a Create React App boilerplate with react-icons
added as a dependency for easy testing.
cd packages/react-icons
yarn fetch
yarn build
cd ../demo
yarn start
Why React SVG components instead of fonts?
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.
Related Projects
Licence
MIT
- Icons are taken from the other projects so please check each project licences accordingly.
Top Related Projects
Simply beautiful open-source icons
The iconic SVG, font, and CSS toolkit
Premium hand-crafted icons built by Ionic, for Ionic apps and web apps everywhere 🌎
A scalable set of icons handcrafted with <3 by GitHub
SVG icons for popular brands
A set of over 5800 free MIT-licensed high-quality SVG icons for you to use in your web projects.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot