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.
npm install phosphor-reactVerified import paths — ran on the pinned version, not inferred.
Demonstrates importing individual icons, using `IconContext.Provider` for global styling, and overriding props on specific icons.
Update your `package.json` and imports to use `@phosphor-icons/react`. Run `npm uninstall phosphor-react && npm install @phosphor-icons/react` or `yarn remove phosphor-react && yarn add @phosphor-icons/react`.
Update your imports and JSX usage to use the `Icon` suffix, e.g., `import { UserIcon } from '@phosphor-icons/react'` and `<UserIcon />`.For RSC usage, change imports from `import { IconName } from '@phosphor-icons/react'` to `import { IconName } from '@phosphor-icons/react/ssr'`.Upgrade to `@phosphor-icons/react@^2.1.10` or later, which explicitly adds `"type": "module"` to `package.json` for more predictable bundler behavior. Ensure your bundler is correctly configured for ESM.
If targeting `react@16`, ensure you are using `@phosphor-icons/react@2.1.5` or newer. Alternatively, if locked to affected versions, configure your build system (e.g., Babel, TypeScript) to use the `classic` JSX runtime.
Ensure your project's bundler is configured to correctly handle ES Modules. If encountering this in Node.js, ensure your package.json has `"type": "module"` or use a transpiler. Sometimes `import pkg from '@phosphor-icons/react'; const { Envelope } = pkg;` can be a workaround for specific bundler issues, but it's not the recommended long-term solution. Upgrade to `@phosphor-icons/react@^2.1.10`.Update `@types/react` to the latest compatible version using `npm install @types/react@latest` or `yarn upgrade @types/react`. This specific issue was addressed and fixed in `v2.1.7`.
Verify the package is installed with `npm install @phosphor-icons/react` or `yarn add @phosphor-icons/react`. Double-check the import statements to ensure they use `@phosphor-icons/react` as the package name, not `phosphor-react`.