Include popular icons in your React projects easily with react-icons, which
utilizes ES6 imports that allow you to include only the icons that your project
is using.
Package options
React Icons is available in three package formats:
Package format
Example package
Import granularity
Typical environments
All icon sets
react-icons
Import icons from an icon set subpath
Vite, Next.js, webpack
Single icon set
@react-icons/fontawesome6
Import icons from the package root
Vite, Next.js, webpack
Individual icon files
@react-icons/fontawesome6_files
Import one icon from each module subpath
Nest.js, Gatsby.js, etc.
Install all icon sets
yarn add react-icons# ornpm install react-icons
Import icons from the subpath for their icon set:
import { FaBeerMugEmpty } from "react-icons/fa6";function Question() { return ( <h3> Lets go for a <FaBeerMugEmpty />? </h3> );}
View the documentation for further
usage examples and icon set subpaths. For example, Material Design icons are
imported from react-icons/md.
Install a single icon set (v6.0.0+)
Install a scoped package when you only need one icon set:
import { FaBeerMugEmpty } from "@react-icons/fontawesome6";function Question() { return ( <h3> Lets go for a <FaBeerMugEmpty />? </h3> );}
Each scoped package contains the same icons as its corresponding react-icons
subpath. For example, @react-icons/fontawesome6 corresponds to
react-icons/fa6.
Install individual icon files (v6.0.0+)
Install the files package for the icon set you need when your environment
requires each icon to have its own module.
import { FaBeerMugEmpty } from "@react-icons/fontawesome6_files/FaBeerMugEmpty";function Question() { return ( <h3> Lets go for a <FaBeerMugEmpty />? </h3> );}
Files packages contain the same icons as the corresponding scoped package, but
only support individual icon module imports. Importing from the package root,
such as @react-icons/fontawesome6_files, is not supported.
The SVG files to be fetched are managed in this file, and their locked Git
commits are stored in packages/react-icons/src/icons/icons.lock. Edit the
definition and run yarn fetch --update, review the lock-file changes, and then
run yarn check && yarn build.
To fetch the currently locked revisions without changing the lock file, run
yarn fetch. To update all locked commits to the latest revisions, run
yarn fetch --update.
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-iconsyarn fetchyarn buildcd ../preview-astroyarn start
Demo
The demo is a Create React App boilerplate with react-icons added as a dependency for easy testing.
cd packages/react-iconsyarn fetchyarn buildcd ../demoyarn 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.