The icon group exports SVG files, lists available icons, and searches by name across local directories, JSON collections, or the Iconify API. Use these commands to explore what a set contains before writing code, or to extract SVGs for projects that use DirectoryProvider instead of JSON collections.
When to use these commands
Finding icons: Search a set by keyword with icon search to discover icon names, or list everything in a prefix with icon list. Both commands work against local JSON files, local SVG directories, or the remote Iconify API.
Exporting SVGs: Extract specific icons (or an entire set) as individual .svg files with icon export. The exported files are standalone SVGs suitable for design tools, templates, or directory-based provider setups.
icon export
Load icons from a downloaded JSON collection and write each as a standalone SVG file. The xmlns attribute is added automatically if missing.
Export specific icons:
swarm-icons icon export lucide home star arrow-rightExport all icons from a set:
swarm-icons icon export tabler --all --dest ./icons/tablerWithout --json, the command looks for ./resources/json/<prefix>.json. Pass --json to use a file at a different path.
Flags
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--all |
bool |
false |
Export all icons from the collection | |
--dest |
-d |
string |
. (current directory) |
Destination directory |
--overwrite |
bool |
false |
Overwrite existing SVG files | |
--json |
string |
Path to a specific JSON collection file |
The first positional argument is the icon set prefix (required). All subsequent arguments are icon names. If no names are given and --all is not set, the command returns an error.
icon list
Display icon names from a local SVG directory, a downloaded JSON collection, or the Iconify API. Results are sorted alphabetically and printed in a three-column layout.
List icons from a downloaded JSON set:
swarm-icons icon list --prefix lucideList icons from the Iconify API (no local download required):
swarm-icons icon list --prefix tabler --iconifyFilter results by name:
swarm-icons icon list --prefix lucide --search arrowFlags
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--path |
string |
Path to a local SVG directory | ||
--prefix |
-p |
string |
Icon set prefix | |
--iconify |
bool |
false |
Fetch icon list from the Iconify API | |
--search |
-s |
string |
Filter by name substring (case-insensitive) |
The three source modes are mutually exclusive in practice:
--pathreads icon names from a local SVG directory.--prefixalone reads from the local JSON file at./resources/json/<prefix>.json.--prefixwith--iconifyfetches the icon list from the Iconify npm API.
icon search
Search icon names by keyword within a specific icon set. Results are sorted, printed in a two-column layout, and paginated every 30 rows.
swarm-icons icon search lucide arrowSearch inside a local SVG directory:
swarm-icons icon search lucide arrow --path ./icons/lucideBoth positional arguments are required: <prefix> and <term>. The search is case-insensitive substring matching on icon names.
Flags
| Flag | Type | Default | Description |
|---|---|---|---|
--path |
string |
Search a local SVG directory instead | |
--json |
string |
Search a local JSON collection file instead |
Without --path or --json, the command tries the local JSON file at ./resources/json/<prefix>.json first. If that file does not exist, it falls back to fetching the icon list from the Iconify API.
See also
- Directory Provider: use exported SVG directories at runtime
- JSON Commands: download the JSON files that
icon exportandicon listread from