AI search

Find icons by describing your use case in natural language.

How It Works

Search embeds what you type with a sentence transformer (all-MiniLM-L6-v2) and ranks it against a pre-computed vector for each of the 2,496 icons, built from its name, keywords and category. One vector per icon, not one per style.

  • Client-side only: runs in your browser via Transformers.js
  • No API key required: completely free
  • Offline-capable: model cached after first load (~22MB)
  • Fast: ~50ms per search after model loads

Try It Now

Search for icons by describing where you'll use them:

Examples:

  • "shopping cart in header"
  • "user profile sidebar"
  • "navigation menu mobile"
  • "settings gear icon"
  • "delete trash button"
  • "download arrow"

Query Tips

Good Queries Less Effective
"cart in checkout page" "cart"
"user avatar dropdown" "user"
"menu hamburger mobile" "menu"
"notification bell badge" "bell"
"play video button" "play"

Be specific about context: the model understands meaning, not just words.

What the site adds

The website ranks with the same vectors, and then:

  • Names count. An icon whose name or keywords contain your words gets a boost, so cart puts the carts first even where the model finds a basket just as close.
  • Typos are fixed. A word that neither the set nor the model knows is matched to the closest word the set does use. Words the model knows are left alone.
  • Several things at once. Separate them with commas: home, settings, user returns the best few of each, side by side.
  • Old names still work. Search for Bag2 and you get BagStraps, the icon it was renamed to in 3.5.0.
  • Only good matches. Results stop where they drop well below the best one, so a long tail of weak guesses does not bury the right icon.

From the terminal

Terminal
npx @devigner-ui/icons search "upload progress"
npx @devigner-ui/icons search "user profile sidebar" --limit=5 --threshold=0.2
npx @devigner-ui/icons search "map pin" --category=location-maps

The CLI ranks against the same embeddings.json the browser does. Embedding the query needs the model, so install it alongside:

Terminal
npm install @xenova/transformers

Without it the command ranks by keyword and says so on stderr; --keyword asks for that path directly and skips the model load. Full options are in the CLI reference.

In your own code

The package ships the vectors, not a search function; there is no @devigner-ui/icons/ai subpath to import. Ranking is a dot product, so it is shorter to write than to depend on:

TypeScript
import { pipeline } from '@xenova/transformers';
import metadata from '@devigner-ui/icons/metadata.json';
import embeddings from '@devigner-ui/icons/embeddings.json';

async function searchIcons(
  query: string,
  { limit = 10, threshold = 0.15, category = null as string | null } = {},
) {
  const extract = await pipeline('feature-extraction', 'Xenova/all-MiniLM-L6-v2', {
    quantized: true,
  });
  const out = await extract(query, { pooling: 'mean', normalize: true });
  const q = Array.from(out.data as Float32Array);

  const pool = category
    ? metadata.icons.filter(i => i.category === category)
    : metadata.icons;

  return pool
    .map(icon => {
      const vec = embeddings[icon.name] ?? [];
      let dot = 0;
      for (let i = 0; i < q.length; i++) dot += q[i] * (vec[i] ?? 0);
      // Stored vectors are unit length scaled by 127; the query is unit
      // length. So this is cosine, in [-1, 1].
      return { icon, score: dot / 127 };
    })
    .filter(r => r.score >= threshold)
    .sort((a, b) => b.score - a.score)
    .slice(0, limit);
}

A lower threshold returns more and worse; 0.15 is where the CLI sits.

Whichever model you use has to be the one that produced the vectors. bge-small is also 384 dimensions, so swapping it in throws nothing; the query just lands in the wrong space and every score becomes noise.

Model Details

Property Value
Model Xenova/all-MiniLM-L6-v2
Dimensions 384
Size (quantized) ~22MB
License Apache-2.0
Runtime Transformers.js (WASM)

Performance

Metric Value
First load ~3-5s (model download)
Subsequent searches ~50ms
Memory usage ~50MB
Accuracy High (semantic understanding)

Privacy

  • No data leaves your browser
  • No tracking: searches are local only
  • Model cached in browser IndexedDB
  • Works offline after first load

Where the vectors come from

The vectors are built from one sentence per icon (its display name, keywords and category), embedded once at build time and quantized to int8, which is why embeddings.json is 2MB rather than 3MB of floats.

Quantization is the reason scores divide by 127 rather than comparing directly. The loss is well under the gap between a good match and a bad one.

Documentation

Browse all 12,480 icons