Skip to main content
go-swarm-icons
On this page

Icon Commands

Documents flags for the export, list, and search subcommands and their source modes.

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:

Terminal window
swarm-icons icon export lucide home star arrow-right

Export all icons from a set:

Terminal window
swarm-icons icon export tabler --all --dest ./icons/tabler

Without --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:

Terminal window
swarm-icons icon list --prefix lucide

List icons from the Iconify API (no local download required):

Terminal window
swarm-icons icon list --prefix tabler --iconify

Filter results by name:

Terminal window
swarm-icons icon list --prefix lucide --search arrow

Flags

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:

  • --path reads icon names from a local SVG directory.
  • --prefix alone reads from the local JSON file at ./resources/json/<prefix>.json.
  • --prefix with --iconify fetches the icon list from the Iconify npm API.

Search icon names by keyword within a specific icon set. Results are sorted, printed in a two-column layout, and paginated every 30 rows.

Terminal window
swarm-icons icon search lucide arrow

Search inside a local SVG directory:

Terminal window
swarm-icons icon search lucide arrow --path ./icons/lucide

Both 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

Edit this page

Last updated: