Skip to content

CLI Reference

Create a new relaxicons.config.json interactively.

Terminal window
relaxicons init

Options:

  • --framework <name>: Skip prompt and set framework.
  • --force: Overwrite existing config.

Fetch an Iconify icon and generate a component.

Terminal window
relaxicons add lucide:alarm-clock

Options:

  • --framework <name>: Override config framework for this icon.
  • --raw: Output raw optimized SVG (no component wrapping).
  • --both: Also write cleaned SVG alongside component.
  • --force: Overwrite an existing icon file.
  • --from <file>: Read multiple icons from a file.
  • --no-svgo: Disable SVGO optimization (if installed).

List available icon collection prefixes.

Terminal window
relaxicons collections
relaxicons collections --filter luc
relaxicons collections --json --limit 20

Options:

  • --filter <text>: Filter collection prefixes.
  • --limit <n>: Limit number printed.
  • --json: Output JSON array.
  • --fields <list>: Choose fields (name,title,count).

List icons within a collection.

Terminal window
relaxicons icons lucide
relaxicons icons lucide --filter home
relaxicons icons lucide --json --limit 10

Options:

  • --filter <text>: Filter icon names.
  • --limit <n>: Limit number printed (default 50).
  • --json: Output JSON array.

Alias for icons <collection>; deprecated and will be removed in v2.0. Use icons.

Search icons across all collections, or scope to one.

Terminal window
relaxicons search arrow
relaxicons search home --collection lucide
relaxicons search star --json --limit 20

Options:

  • --collection <prefix>: Limit to a collection.
  • --limit <n>: Maximum results to print.
  • --json: Output JSON. Note: Results are fetched using cached collection metadata when available.

Remove a generated icon file and update barrel exports.

Terminal window
relaxicons remove lucide:home

Validate config, environment, and API reachability.

Terminal window
relaxicons doctor

Refresh local cache for collections and icons to improve offline and faster lookup.

Terminal window
relaxicons update-cache

Caching The CLI caches Iconify metadata under ~/.cache/relaxicons (configurable via RELAXICONS_CACHE_DIR). Cache uses ETag and TTL; stale cache is used on network failures. Set RELAXICONS_OFFLINE=1 to force offline mode (errors on cache miss).

Output a basic completion script you can source in your shell.

Terminal window
relaxicons completion zsh
CodeMeaning
0Success
1Unhandled error
2Config missing or invalid
3Icon fetch failed
4Duplicate without —force

If an icon isn’t found, similar names (Levenshtein-lite character overlap) are displayed.

Example:

Terminal window
relaxicons add lucide:alrm-clock
# => Icon not found. Did you mean: alarm-clock, alarm-check, alarm-off ?

Icon IDs like alarm-clock become AlarmClockIcon via PascalCase + Icon suffix.

A barrel index.ts (or .js) is updated automatically with new exports on each add.

Works with Node 18+.

  • Caching: If collections or icons seem stale, run relaxicons update-cache or delete ~/.cache/relaxicons.
  • Rate limits: The CLI retries and uses cache on failures; try again later or use RELAXICONS_OFFLINE=1 when cache is warm.
  • Offline mode: Set RELAXICONS_OFFLINE=1 to use cache only (errors on cache miss).

Install the framework runtime in your app if not already present:

Terminal window
# React / Next.js
npm i react react-dom
npm i next # if using Next.js
# Vue
npm i vue
# Angular
npm i @angular/core
# Svelte
npm i svelte
# Solid
npm i solid-js
# Web Components
# No framework dependency required
Terminal window
relaxicons add lucide:home --force

Replaces existing component file and re-appends export (duplicate lines cleaned).

Terminal window
relaxicons add lucide:star --raw

Writes star.svg transformed (dimensions stripped, currentColor applied) inside outDir.

Terminal window
relaxicons add lucide:bolt --framework vue

Generates a Vue SFC even if config framework is React.

Supported values: react, next, next-rsc, vue, angular, laravel, svelte, solid, webc.

Terminal window
for icon in home star bell; do relaxicons add lucide:$icon; done
Terminal window
relaxicons icons lucide | grep clock
relaxicons search clock | grep lucide
TaskCommand
Init configrelaxicons init
Add React iconrelaxicons add lucide:home
Add Vue iconrelaxicons add lucide:home --framework vue
Raw SVGrelaxicons add lucide:home --raw
Force overwriterelaxicons add lucide:home --force
List collection iconsrelaxicons icons lucide
List collectionsrelaxicons collections
Search iconsrelaxicons search arrow
JSON icons listrelaxicons icons lucide --json
JSON collections listrelaxicons collections --json
Remove iconrelaxicons remove lucide:home
Doctorrelaxicons doctor
Suggest similarrelaxicons add lucide:hoem