Skip to content

akx/react-icons-gen

Repository files navigation

react-icons-gen

A tool to generate a subset of React icons from react-icons, including only the specific icons you use in your project.

Installation

npm install --save-dev react-icons-gen
# or
yarn add --dev react-icons-gen
# or
pnpm add --save-dev react-icons-gen

Usage

  1. Create a manifest file in TOML format that defines which icons you want to include
  2. Run the tool with the manifest file as an argument
npx react-icons-gen manifest.toml

Manifest File Format

The manifest file is a TOML file that defines which icons you want to include and where to output them.

Manifest Format

  • [[entry]]: Defines an entry in the manifest (you can have multiple entries)
  • file: The output file where the generated icons will be written
  • icons: An array of icons to include, in the format "module:IconName"
    • Example: "react-icons/fa:FaTrash" includes the FaTrash icon from the react-icons/fa module

Example

[[entry]]
file = "src/icons.ts"
icons = [
    "react-icons/fa:FaTrash",
    "react-icons/fa:FaCaretDown",
    "react-icons/fa:FaCopy",
]

Props

The generated icons accept all standard SVG attributes plus:

  • size: Sets both width and height (default: "1em")
  • title: Adds a title to the SVG for accessibility

License

MIT

About

Subset react-icons to only include the icons you use in your project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  

Packages

No packages published