React Icons

5.6.0 · active · verified Sun Apr 19

React Icons is a popular library for easily including a vast collection of SVG icons in React projects. It currently stands at stable version `5.6.0` and exhibits a very active release cadence, frequently updating to incorporate the latest versions of various icon libraries and maintain compatibility with modern React versions, such as the recent update for React 19 in v5.5.0. A key differentiator is its use of ES6 imports, enabling effective tree-shaking to include only the icons actively used in a project, thus optimizing bundle size. It aggregates icons from numerous popular sets like Font Awesome 5/6, Material Design, Ionicons, and Octicons, making a wide array of visual assets accessible through a consistent API. Unlike some icon solutions, React Icons directly provides SVG components, which offers high customization and styling flexibility.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates importing icons from different sets, using the `IconContext.Provider` for global styling, and applying local style overrides.

import React from 'react';
import { FaBeer } from 'react-icons/fa';
import { MdOutlineFastfood } from 'react-icons/md';
import { IconContext } from 'react-icons';

function MyIconComponent() {
  return (
    <IconContext.Provider value={{ color: "blue", size: "3em", className: "global-icons" }}>
      <div style={{ padding: '20px', fontFamily: 'Arial, sans-serif' }}>
        <h1>My Favorite Things</h1>
        <p>
          Let's go for a <FaBeer title="Beer icon" /> and grab some <MdOutlineFastfood title="Fast food icon" />.
        </p>
        <p style={{ color: "green", fontSize: "2em" }}>
          You can also override global styles locally, like this <FaBeer />.
        </p>
        <p>
          The icons automatically scale with the text size unless explicitly styled or controlled by context.
        </p>
      </div>
    </IconContext.Provider>
  );
}

export default MyIconComponent;

view raw JSON →