Search across all documentation pages
🤖 Read the SystemsArchitect.io Blog for over 100+ cloud architecture articles 🔥
Install React Icons to access thousands of icons from popular icon families through a single package. Each icon family uses a two-letter prefix and its own import path for tree-shaking.
npm install react-icons// app/components/icon-sampler.tsx
"use client";
import { FaGithub, FaTwitter } from "react-icons/fa";
import { MdEmail, MdSettings } from "react-icons/md";
import { HiOutlineSearch } from "react-icons/hi";
import { FiMenu } from "react-icons/fi";
export function IconSampler() {
return (
<div className="flex items-center gap-4 text-2xl">
<FaGithub />
<FaTwitter className="text-blue-400" />
<MdEmail className="text-red-500" />
<MdSettings className="text-gray-600" />
<HiOutlineSearch />
<FiMenu />
</div>
);
}| Prefix | Icon Set | Icon Count | Style |
|---|---|---|---|
| Fa | Font Awesome 5 | 1,600+ | Solid and regular |
| Fa6 | Font Awesome 6 | 2,000+ | Solid, regular, brands |
| Md | Material Design | 4,300+ | Filled and outlined |
| Hi | Heroicons v1 | 450+ | Outline and solid |
| Hi2 | Heroicons v2 | 600+ | Outline, solid, mini |
| Fi | Feather Icons | 280+ | Stroke-based |
| Bs | Bootstrap Icons | 1,800+ | Filled and outline |
| Ai | Ant Design | 780+ | Filled and outlined |
| Si | Simple Icons (brands) | 2,500+ | Brand logos |
| Tb | Tabler Icons | 4,600+ | Stroke-based |
| Lu | Lucide | 1,400+ | Stroke-based |
A social media links bar using icons from multiple families:
// app/components/social-links.tsx
"use client";
import { FaGithub, FaLinkedinIn, FaYoutube } from "react-icons/fa";
import { FaXTwitter } from "react-icons/fa6";
import { SiBluesky, SiDiscord } from "react-icons/si";
import { IconContext } from "react-icons";
interface SocialLink {
href: string;
icon: React.ElementType;
label: string;
hoverColor: string;
}
const socialLinks: SocialLink[] = [
{ href: "https://github.com/username", icon: FaGithub, label: "GitHub", hoverColor: "hover:text-gray-900" },
{ href: "https://x.com/username", icon: FaXTwitter, label: "X (Twitter)", hoverColor: "hover:text-black" },
{ href: "https://linkedin.com/in/username", icon: FaLinkedinIn, label: "LinkedIn", hoverColor: "hover:text-blue-700" },
{ href: "https://youtube.com/@username", icon: FaYoutube, label: "YouTube", hoverColor: "hover:text-red-600" },
{ href: "https://bsky.app/profile/username", icon: SiBluesky, label: "Bluesky", hoverColor: "hover:text-blue-500" },
{ href: "https://discord.gg/invite", icon: SiDiscord, label: "Discord", hoverColor: "hover:text-indigo-500" },
];
export function SocialLinksBar() {
return (
<IconContext.Provider value={{ size: "1.5rem" }}>
<nav aria-label="Social media links" className="flex items-center gap-6">
{socialLinks.map(({ href, icon: Icon, label, hoverColor }) => (
<a
key={label}
href={href}
target="_blank"
rel="noopener noreferrer"
aria-label={label}
className={`text-gray-500 transition-colors ${hoverColor}`}
>
<Icon />
</a>
))}
</nav>
</IconContext.Provider>
);
}react-icons/fa, react-icons/md, etc.).font-size and color from their parent by default (using 1em and currentColor).IconContext.Provider lets you set default size, color, className, and style for all descendant icons without repeating props.Global styling with IconContext:
import { IconContext } from "react-icons";
export function IconProvider({ children }: { children: React.ReactNode }) {
return (
<IconContext.Provider
value={{
size: "1.25rem",
className: "inline-block align-middle",
style: { verticalAlign: "middle" },
}}
>
{children}
</IconContext.Provider>
);
}Comparing bundle size impact:
// GOOD: imports only FaGithub (~1KB)
import { FaGithub } from "react-icons/fa";
// BAD: still only imports FaGithub, but some older bundler configs
// may not tree-shake this correctly
import { FaGithub } from "react-icons";Always import from the specific family path (react-icons/fa) rather than the package root.
React.ComponentType<IconBaseProps>.IconBaseProps extends SVGAttributes<SVGElement> and adds size, color, title, and className.IconContext is typed as React.Context<IconBaseProps>.import type { IconType } from "react-icons";
interface NavItem {
icon: IconType;
label: string;
href: string;
}react-icons (the root) instead of a sub-path like react-icons/fa can bundle the entire library in some configurations. Always use the family-specific import path.IconContext uses React Context, so the provider component must be a Client Component in Next.js App Router.size prop accepts a string (like "1.5rem") or number. When using a number, it maps to pixels.
| Approach | Pros | Cons |
|---|---|---|
| React Icons | One package for many icon families | Large install size on disk, potential bundle bloat |
| Lucide React | Better tree-shaking, consistent style | Single icon style only |
| Direct icon library (@heroicons/react) | Official package, tighter integration | Only one icon family per package |
| SVG sprites | Smallest possible bundle | Manual setup, no component API |
Each family has its own import path using a two-letter prefix:
import { FaGithub } from "react-icons/fa"; // Font Awesome
import { MdEmail } from "react-icons/md"; // Material Design
import { HiOutlineSearch } from "react-icons/hi"; // Heroiconssize, color, className, and style for all descendant icons.react-icons/fa, react-icons/md) for proper tree-shaking.1em for size and currentColor for color.font-size and color from their parent element automatically.IconContext.import type { IconType } from "react-icons";
interface NavItem {
icon: IconType;
label: string;
href: string;
}IconType is equivalent to React.ComponentType<IconBaseProps>.
IconBaseProps extends SVGAttributes<SVGElement>.size, color, title, and className properties.IconContext is typed as React.Context<IconBaseProps>.<IconContext.Provider
value={{
size: "1.25rem",
className: "inline-block align-middle",
style: { verticalAlign: "middle" },
}}
>
{children}
</IconContext.Provider>"1.5rem") and numbers.Tb) has the most with 4,600+ icons.Md) follows with 4,300+ icons.Reviewed by Chris St. John·Last updated Jul 19, 2026
🤖 Read the SystemsArchitect.io Blog for over 100+ cloud architecture articles 🔥