Phosphor React Icons

1.4.1 · active · verified Sun Apr 19

Phosphor React is a comprehensive icon library for React applications, providing a flexible and visually consistent icon family. The current stable version is 2.1.10, actively maintained with frequent minor and patch releases that add new icons, features, and bug fixes. Key differentiators include six distinct weights (thin, light, regular, bold, fill, duotone) for stylistic versatility, robust support for React Context to manage global icon styling, and full compatibility with standard SVG properties. The library is tree-shaking friendly, ensuring optimal bundle sizes, and offers official support for React Server Components (RSC) and server-side rendering (SSR) via a dedicated submodule. It also integrates JSDoc icon previews for enhanced developer experience.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates importing individual icons, using `IconContext.Provider` for global styling, and overriding props on specific icons.

import React from 'react';
import ReactDOM from 'react-dom/client';
import { IconContext, HorseIcon, HeartIcon, CubeIcon } from '@phosphor-icons/react';

const App = () => {
  return (
    <IconContext.Provider
      value={{
        color: 'limegreen',
        size: 32,
        weight: 'bold',
        mirrored: false,
      }}
    >
      <div style={{ padding: '20px', fontFamily: 'sans-serif' }}>
        <h1>My Awesome Icons</h1>
        <p>Icons inheriting context defaults:</p>
        <HorseIcon /> {/* Will be lime-green, 32px, and bold! */}
        <HeartIcon /> {/* Me too! */}
        <CubeIcon /> {/* Me three :) */}

        <p>Icons with overridden props:</p>
        <HeartIcon color="#AE2983" weight="fill" size={48} />
        <CubeIcon color="teal" weight="duotone" mirrored={true} />
      </div>
    </IconContext.Provider>
  );
};

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render(<App />);

view raw JSON →