@mrzr/react-svg-icons

A folder of SVGs to typed React components.

Every icon becomes a typed TSX component with props for its size and each of its colours, plus a lazy-loaded Icon with a typed name.

npm install --save-dev @mrzr/react-svg-icons
npx @mrzr/react-svg-icons
Version
v0.1.1
Published
Nov 2026
License
MIT
Requirements
Node.js 20 or newer. The generated code needs React (tested with 19) and "moduleResolution": "bundler".
Generatebash
# react-svg-icons.config.yaml
#   input: icons
#   outDir: generated

npx @mrzr/react-svg-icons           # writes the components into generated/
npx @mrzr/react-svg-icons --check   # exit 1 when they are out of date
Usetsx
import { Icon } from "./generated";
import { Logout } from "./generated/bold";

<Icon name="bold.logout" size={20} />
<Logout size={20} color="crimson" />

What it does

A component per SVG

Optimised with SVGO, with a forwarded ref.

Props for every colour

size, color, stroke, fill, strokeWidth, opacity, title, and per-path colors, opacities and strokeWidths.

A typed Icon name

name="bold.logut" is a type error, and each icon loads as its own chunk.

Your formatting, your CI

Output runs through your own prettier, --check fails stale output, and removed SVGs are cleaned up.

Documentation

Everything is documented.

Start reading

More in design pipeline