Your new favorite way to manage icons for your Vite, NextJS projects without icon libraries!
Based on my blog post on Why you might not need an icon library. Built with ๐ฆ Rust, โก๏ธ designed for speed, ๐ฆ made for developers who hate icon library bloat.
Stop installing bloated icon libraries. All you need is icones.js.org or your designer's Figma icon pack and paste them into your project with surgical precision.
What Makes It Special โจ
- Zero Dependencies ๐ฆ: Just a CLI, No icon libraries to bundle
- Framework Native ๐งฉ: Works with React, Vue, Svelte, Solid - generates components automatically
- Interactive Mode ๐ฎ: Just run
iconmate
and let it guide you - URL Support ๐: Fetch from any SVG URL, not just iconify
- Raw SVG ๐: Copy-paste SVG code directly
- Empty SVG ๐๏ธ: Create placeholder icons for rapid prototyping
# Install
npm install -g iconmate
# Run inside your project ๐
iconmate
> ๐ Folder (src/assets/icons/) # Enter
> โจ Preset # Choose react
> ๐ Icon # heroicons:heart
> ๐ Name # Heart
โจ That's it. The interactive CLI guides you through adding icon to your project!
// ๐ Then, you can just easily use any icon on your project like this!
import { IconHeart } from "@/assets/icons";
function MyApp() {
return <IconHeart />;
}
You can also add sensible defaults by passing flags:
iconmate --folder src/components/Icons/ --folder src/components/icons
iconmate --folder src/components/Icons/ --icon heroicons:heart --name Heart
npm install -g iconmate
# or
pnpm add -g iconmate
# or
bun add -g iconmate
For one-off usage:
npx iconmate
# or
pnpm dlx iconmate
# or
bunx iconmate
Note
Note for Bun users: Bun doesn't run postinstall
scripts by default which is needed to install the iconmate binary. Add "trustedDependencies": ["iconmate"]
to your package.json
to do it! But you're only limited to running it with a package.json.
Recommended: Just use pnpx for quick one-off usage. If in a project, either install globally or configure trustDependencies.
cargo install iconmate
Or clone and install from source:
git clone https://github.com/blankeos/iconmate.git
cd iconmate
cargo install --path .
Determines the output filetype and the contents inside that file type.
Preset | File Type | Framework |
---|---|---|
normal |
.svg |
Vanilla HTML/CSS |
react |
.tsx |
React Components |
svelte |
.svelte |
Svelte Components |
solid |
.tsx |
Solid Components |
vue |
.vue |
Vue Components |
emptysvg |
.svg |
Placeholder |
Important
If you want to use .svg
file types, make sure to setup svgr. I covered how to do this in:
- SolidJS (Vite)
- React (Vite)
- React (NextJS)
- Vue - contribution welcome!
- Svelte - couldn't find an svgr integration :(
iconmate
# Description of each prompt:
> ๐ Folder (src/assets/icons/) # where your icons will be saved.
> โจ Preset # i.e. How will it be saved? An `.svg` or `.tsx` file in react, solid, etc.
> ๐ Icon # Source of your icon. i.e. 'heroicons:heart' from https://icones.js.org, full URL, or any SVG. Can be empty except for 'emptysvg' preset.
> ๐ Filename # The filename without the extension. i.e. heroicons:heart. Will only be prompted if you used an SVG, or an URL on icon.
> ๐ Name # The "Heart" in <IconHeart />
iconmate add --folder src/assets/icons --icon heroicons:heart --name Heart
iconmate add --folder src/assets/icons --icon https://api.iconify.design/mdi:heart.svg --name Heart
iconmate add --folder src/assets/icons --icon '<svg>...</svg>' --name Heart
iconmate add --folder src/assets/icons --icon heroicons:heart --name Heart --output-line-template "export { ReactComponent as Icon%name% } from './%icon%.svg?react';"
iconmate delete --folder src/assets/icons
Best practice: Add sensible defaults to your script runner.
- macOS (Intel & Apple Silicon) ๐
- Linux (x64 & ARM64) ๐ง
- Windows (x64) ๐ช
- Find your icon: Visit https://icones.js.org.
- Copy the name: Like
heroicons:heart
. - Run iconmate:
iconmate
- Copy-paste workflow: Find icon on icones.js.org โ copy name โ paste into iconmate
- Organized by default: Everything goes into
index.ts
exports automatically and just typing<Icon
will autosuggest from your current collection. Just regular TS behavior. - TypeScript ready: Generated code is fully typed. Pass custom width, height, fills, you name it.
- Customizable ๐จ: Want to add a default Tailwind class on every icon? custom props? Just add it to the file!
- Git-friendly: Plain SVG files, no binary assets
- Lightning fast: Native Rust binary, no Node.js startup time
Contributions are welcomeโpull requests for bug fixes, new framework presets, or improvements are appreciated.
๐ฑ Repo: github.com/Blankeos/iconmate - Star it if you love it โญ
- โ Interactive prompt mode
- โ Framework presets (React, Vue, Svelte, Solid)
- โ URL and raw SVG support
- โ Custom export templates
- โ Zero-config installation
- An empty command. Creates an .svg, adds it to the index.ts with a name you can specify.
- Paste an actual svg instead of an icon
name
. - Just a
--preset=svg,react,solid,svelte,vue
- which basically overrides templates. Default issvg
. - Prompt Mode via
iconmate
- Interactive mode so you won't need to pass arguments. - Delete an icon using
iconmate delete
- Other frameworks i.e. --preset=flutter or Go/Rust GUI apps? (Not sure how they work yet though).
-
Zed or VSCode Extension(seems unnecessary now, it's just a CLI)
Made with Rust ๐ฆ | Based on my blog post