Add SVG Icons to shadcn/ui, One Command Install

Learn how to add SVG icons to your shadcn/ui project with a single command. No Iconify needed. Choose your package manager, copy, and install icons like lucide, heroicons, or phosphor directly.

Amit Yadav
Amit Yadav

Add production-ready SVG icon components to your shadcn/ui project in seconds. No Iconify setup, no extra dependencies, just copy, run, and use.

Tip

Coding with an AI agent? Skip browsing packs by hand, let it search and insert the right icon for you. See MCP for AI Agents below.

Quick Install (3 Clicks)

Select your package manager, pick an icon below, and run the command in your terminal:

That’s it. The icon component lands in your project ready to use:

import Plus from "@/assets/icons/lucide/plus.svg"

// Use it like any component
<Plus className="w-4 h-4" />
Tip

Works with pnpm, npm, yarn, and bun. Your preference is saved for next time.

Add Icons from Other Packs

The same command works for any icon pack. Just swap the pack name and icon:

Icon PackInstall Command Format
Lucidepnpm dlx shadcn@latest add https://i.allsvgicons.com/r/lucide:{icon}.json
Heroiconspnpm dlx shadcn@latest add https://i.allsvgicons.com/r/heroicons:{icon}.json
Phosphorpnpm dlx shadcn@latest add https://i.allsvgicons.com/r/phosphor:{icon}.json
Tablerpnpm dlx shadcn@latest add https://i.allsvgicons.com/r/tabler:{icon}.json
Info

Browse all available icon packs at allsvgicons.com

Why Direct Install?

  • No extra package: skip installing Iconify as a dependency
  • Smaller bundle: only your installed icons ship with the app
  • Full ownership: icon components live in your codebase
  • Better DX: TypeScript autocomplete works out of the box

This works because AllSVGIcons uses open icon data from Iconify, same icons, different install path.

What Happens After Install

  • Icon added as a React component in your assets/icons folder
  • No fill or stroke colors baked in, control styling via Tailwind classes or CSS
  • Works with your existing shadcn/ui component architecture

When Your Agent Doesn’t Know the Icon Name

The install command above needs an exact {pack}:{icon} name upfront. Fine when you already know it’s lucide:alarm-clock. Not fine when you just want “an icon for a shipping notification” and don’t want to scroll through a pack by hand.

That’s what the allsvgicons MCP server is for. Instead of browsing, your agent calls search_icons("shipping notification"), gets back matching icons across all packs ranked by relevance, then get_icon to pull the SVG straight into the file it’s editing. No tab-switching to the site, no guessing pack names.

Registry install (this guide)MCP server
You already know the exact icon nameBest fit, one commandOverkill
You’re describing what you want, not naming itManual search on the site firstAgent finds it directly
Cross-pack search by meaningNot supportedsearch_icons does full-text intent matching
SetupZero, just run the install commandOne-time MCP config, paid

Use the registry for icons you can already name. Use the MCP server when you’d rather describe the icon and let the agent find it. Setup and pricing: allsvgicons MCP for AI Agents.

Advanced: Custom Registry Namespace

For teams wanting more control, configure a custom namespace in components.json:

{
  "registries": {
    "@allsvgicons": {
      "url": "https://i.allsvgicons.com/r/{name}.json",
      "params": { "format": "svg", "layout": "grouped" }
    }
  }
}

Then use shorter commands:

pnpm dlx shadcn@latest add @allsvgicons/lucide:alarm-clock
Tip

Rename @allsvgicons to any namespace that fits your team’s naming conventions.

Registry API Routes

MethodEndpointPurpose
GET/r/registry.jsonList all available icon collections
GET/r/{pack}.jsonGet icons from a specific pack (paginated)
GET/r/{pack}:{icon}.jsonGet a single icon as component

Query parameters:

  • format=svg (default) or format=react
  • layout=grouped (default) or layout=flat
  • limit=20 (max, default 20)
  • offset=0 (pagination offset)

Examples:

  • /r/registry.json
  • /r/lucide.json?format=svg&layout=flat
  • /r/heroicons:check.json?format=react

Coming Soon

  • Vue, Flutter, Astro, Svelte, and Solid format support
  • Icon search integrated into shadcn CLI (today, search lives in the MCP server)
Info

Have a feature request or ran into an issue? Let us know.

Share this post