react-feather is a widely used React component library offering a collection of Feather icons, meticulously designed on a 24x24 grid for optimal simplicity, consistency, and readability. Currently at version 2.0.10, the library is actively maintained and provides a stable solution for integrating vectorized icons into React applications. It differentiates itself by providing each icon as an individual React component, allowing for easy customization through standard React props like `color`, `size`, and `strokeWidth`. This approach ensures that icons can be styled dynamically and rendered as inline SVGs, leveraging all the advantages of vector graphics without complex build steps. The package ships with TypeScript types, facilitating robust development, and supports modern ES modules for efficient bundling while also offering CommonJS compatibility for legacy setups.
npm install react-featherVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import and use individual Feather icons as React components, customizing their appearance with props like `color`, `size`, and `strokeWidth`.
Migrate your icon imports to named imports (e.g., `import { Camera } from 'react-feather';`) or use the wildcard import (`import * as Icon from 'react-feather';`). If using CommonJS, explicitly target `require('react-feather/dist/icons/icon-name').default;`.Use `const IconName = require('react-feather/dist/icons/icon-name').default;` for CommonJS imports of specific icons.Ensure your project's `react` and `react-dom` versions are `>=16.8.6`. Upgrade React if necessary.
Verify your Webpack/Rollup configuration supports tree-shaking for ES modules. For some setups, specific Babel plugins (e.g., `babel-plugin-import`) might be needed for optimal bundle size when importing many icons.
Double-check the icon name for typos. Ensure you're using `import { IconName } from 'react-feather';` for ESM or `const IconName = require('react-feather/dist/icons/icon-name').default;` for CommonJS.Always use `react-feather` icons as JSX components: `<Camera />`.
Run `npm install react-feather` or `yarn add react-feather` in your project directory.