React SVG Icons – Best Free Libraries & How to Use Them

The best SVG icon libraries for React in 2026. Compare lucide-react, @heroicons/react, @phosphor-icons/react and more. Copy, download, or install in seconds.

Amit Yadav
Amit Yadav

React has a rich ecosystem of SVG icon libraries. Here’s how to pick one and use it — from copy-paste SVG to tree-shakeable React components.

LibraryPackageIconsLicense
Lucidelucide-react1,500+MIT
Heroicons@heroicons/react292MIT
Phosphor@phosphor-icons/react1,200+MIT
Tabler@tabler/icons-react5,000+MIT
Remix Iconsremixicon-react2,800+Apache 2.0

Install a React icon library

# Lucide (most popular, MIT)
npm install lucide-react

# Heroicons (Tailwind team, MIT)
npm install @heroicons/react

# Phosphor (6 weights, MIT)
npm install @phosphor-icons/react

Import and render an icon

// lucide-react — named exports per icon
import { Search, Bell, Settings } from 'lucide-react';

export function Nav() {
  return (
    <nav className="flex items-center gap-4">
      <Search size={20} strokeWidth={1.5} />
      <Bell size={20} />
      <Settings size={20} />
    </nav>
  );
}
// heroicons — outline or solid variant paths
import { MagnifyingGlassIcon, BellIcon } from '@heroicons/react/24/outline';

export function Nav() {
  return (
    <nav className="flex items-center gap-4">
      <MagnifyingGlassIcon className="h-5 w-5" />
      <BellIcon className="h-5 w-5" />
    </nav>
  );
}

Control size and color

// Lucide — size and strokeWidth props
<Search size={16} />   {/* 16px */}
<Search size={24} />   {/* 24px */}
<Search size={32} />   {/* 32px */}

// Color via Tailwind className (both libraries)
<Search className="text-primary" size={20} />
<Search className="text-red-500 hover:text-red-700" size={20} />

// Color via style prop
<Search size={20} style={{ color: '#6366f1' }} />

Icons in buttons

Tip

Put the accessible label on the <button>, not the icon. Use aria-hidden="true" on decorative icons.

// Icon-only button — label on button
<button aria-label="Search">
  <Search size={20} aria-hidden="true" />
</button>

// Button with icon and text
<button className="inline-flex items-center gap-2">
  <Download size={16} aria-hidden="true" />
  Download SVG
</button>

Use SVG directly (no install needed)

For one-off icons or static sites, copy an SVG from AllSVGIcons and paste it inline:

// Paste SVG inline — no package needed
function SearchIcon({ size = 20 }: { size?: number }) {
  return (
    <svg
      xmlns="http://www.w3.org/2000/svg"
      width={size}
      height={size}
      viewBox="0 0 24 24"
      fill="none"
      stroke="currentColor"
      strokeWidth={2}
      strokeLinecap="round"
      strokeLinejoin="round"
      aria-hidden="true"
    >
      <circle cx="11" cy="11" r="8" />
      <path d="m21 21-4.3-4.3" />
    </svg>
  );
}

Server Components (App Router)

Lucide, Heroicons, Tabler, and Phosphor all work in React Server Components — they export pure SVG elements with no client-side state:

// app/page.tsx — Server Component, no 'use client' directive needed
import { Search } from 'lucide-react';

export default function Page() {
  return <Search size={20} />;
}

Frequently asked questions

Lucide React is the most popular choice in 2026: MIT licensed, 1,500+ icons, excellent TypeScript support, and a simple API. Heroicons is the best option for Tailwind CSS projects.

Copy the SVG code from AllSVGIcons and paste it inline in your JSX. Make sure to replace class with className and change stroke or fill to currentColor so the icon inherits text color.

Add aria-hidden='true' to decorative icons, or use role='img' with an aria-label for meaningful icons. For icon-only buttons, put the label on the button element, not the SVG.

Most React icon libraries accept a size prop: . For inline SVGs, set width and height attributes or use CSS. With Tailwind, use h-5 w-5 classes.

Yes. Lucide, Heroicons, Tabler, and Phosphor are all compatible with React Server Components — they export pure SVG elements with no client-side hooks or context.
Share this post