iconvaultkit
TypeScript client for searching and fetching icons from 200,000+ open-source icons across 90+ libraries. Zero dependencies. Works in Node.js, Bun, Deno, and the browser.
Install
npm install iconvaultkitQuick start
import { searchIcons, getIconSvg, listCollections } from "iconvaultkit"
// Search across all 90+ libraries
const result = await searchIcons("home")
console.log(result.icons)
// ["mdi:home", "lucide:home", "heroicons:home", ...]
// Search within one library
const lucide = await searchIcons("arrow right", { collection: "lucide", limit: 5 })
// Get SVG markup
const svg = await getIconSvg("lucide", "home", { color: "#6366f1", size: 24 })
// <svg xmlns="http://www.w3.org/2000/svg" width="24" ...>...</svg>
// List all available libraries
const libraries = listCollections()
// [{ prefix: "mdi", name: "Material Design Icons" }, ...]Class API
All standalone functions use a shared default instance. Use the class directly when you need a custom base URL (e.g. a self-hosted Iconify proxy).
import { IconVaultKit } from "iconvaultkit"
const client = new IconVaultKit({ baseUrl: "https://your-proxy.example.com" })
const result = await client.search("home", { collection: "lucide" })
const svg = await client.getSvg("lucide", "home", { size: 32 })Functions
searchIcons(query, options?)Search icons by keyword across all (or one) library.
Parameters
querystringKeyword to search foroptions.collectionLibraryPrefixoptionalRestrict to one library prefix, e.g. 'lucide'options.limitnumberoptionalMax results, default 20, max 100options.startnumberoptionalPagination offset, default 0Returns
Promise<SearchResult>Example
const result = await searchIcons("home", { collection: "lucide", limit: 5 })
// result.icons → ["lucide:home", "lucide:home-3d", ...]
// result.total → 1getIconSvg(collection, name, options?)Fetch the SVG markup for a specific icon.
Parameters
collectionstringLibrary prefix, e.g. 'lucide'namestringIcon name, e.g. 'home'options.colorstringoptionalCSS color value, default 'currentColor'options.sizenumberoptionalSets width and height, default 24options.widthnumberoptionalWidth in pixelsoptions.heightnumberoptionalHeight in pixelsReturns
Promise<string> — raw SVG markupExample
const svg = await getIconSvg("lucide", "home", { color: "#6366f1", size: 32 })
// → '<svg xmlns="http://www.w3.org/2000/svg" width="32" ...>...</svg>'listCollections()List all 90+ available icon libraries. Synchronous, no network request.
Returns
Collection[] — { prefix: string, name: string }[]Example
const libs = listCollections()
// → [{ prefix: "mdi", name: "Material Design Icons" }, ...]getCollectionIcons(collection, options?)Browse all icons in a specific library.
Parameters
collectionstringLibrary prefix, e.g. 'heroicons'options.limitnumberoptionalMax icons to return, default 200Returns
Promise<string[]> — icon IDs in 'collection:name' formatExample
const icons = await getCollectionIcons("heroicons", { limit: 10 })
// → ["heroicons:home", "heroicons:user", ...]searchAndGetSvg(query, searchOptions?, svgOptions?)Convenience: search and immediately return the SVG of the top result.
Parameters
querystringKeyword to search forsearchOptionsSearchOptionsoptionalSame options as searchIconssvgOptionsSvgOptionsoptionalSame options as getIconSvgReturns
Promise<{ iconId: string; svg: string } | null>Example
const result = await searchAndGetSvg("home", { collection: "lucide" }, { size: 24 })
// result.iconId → "lucide:home"
// result.svg → '<svg ...>...</svg>'parseIconId(iconId)Parse a 'collection:name' icon ID into its parts. Synchronous.
Parameters
iconIdstringIcon ID in 'collection:name' formatReturns
{ collection: string, name: string }Example
const { collection, name } = parseIconId("lucide:arrow-right")
// collection → "lucide"
// name → "arrow-right"TypeScript
The package ships full declarations including a LibraryPrefix union type that autocompletes all 90+ known library prefixes.
import type { LibraryPrefix, SearchResult, SvgOptions } from "iconvaultkit"
const collection: LibraryPrefix = "lucide" // autocompletes all known prefixes
async function getHomeIcon(lib: LibraryPrefix): Promise<string> {
return getIconSvg(lib, "home", { size: 24 })
}Common use cases
Write an icon to a file
import { getIconSvg } from "iconvaultkit"
import { writeFileSync } from "fs"
const svg = await getIconSvg("lucide", "home", { color: "#000", size: 48 })
writeFileSync("home.svg", svg)Build a custom icon picker
import { searchIcons, getIconSvg, parseIconId } from "iconvaultkit"
// Search
const { icons } = await searchIcons(userInput, { limit: 20 })
// User picks one — fetch its SVG
const { collection, name } = parseIconId(icons[0])
const svg = await getIconSvg(collection, name, { size: 24 })Find an icon and use it in one call
import { searchAndGetSvg } from "iconvaultkit"
const result = await searchAndGetSvg("settings", { collection: "heroicons" }, { size: 20 })
if (result) {
console.log(result.iconId) // "heroicons:cog-6-tooth"
console.log(result.svg) // <svg ...>...</svg>
}Links
- npmjs.com/package/iconvaultkit — package page
- iconvaultkit.com/mcp — MCP server for AI agents (Claude Code, Cursor, Windsurf)
- iconvaultkit.com/icons — browse icons in the browser
- info@iconvaultkit.com — questions and feedback