Icons · 350 words · updated 2026-09-20
How to Use SVG Icons in React, Next.js and Vue (Iconify, Sprites, Components)
Four ways to ship SVG icons in a modern frontend: Iconify components, unplugin-icons at build time, SVG sprites, and inline components. Bundle size and a11y compared.
By Serhii Dovhyi, motion designer and founder of Free Creative Assets
Every icon in the Free Creative Assets icon search can be used in a React or Vue app in four ways. They differ in bundle size, runtime cost and how easy they are to swap later.
Option 1: Iconify components (runtime)
npm i @iconify/react
import { Icon } from '@iconify/react';
<Icon icon="lucide:arrow-right" width="20" />
Icons load on demand from the Iconify API (or a self-hosted API) and are cached. Zero build config, access to 200,000 icons by name. Trade-off: a network request on first use, so avoid it for above-the-fold icons unless you bundle them.
Option 2: unplugin-icons (build time, recommended)
npm i -D unplugin-icons @iconify/json
// vite.config.ts
import Icons from 'unplugin-icons/vite';
export default { plugins: [Icons({ compiler: 'jsx', jsx: 'react' })] };
// component
import ArrowRight from '~icons/lucide/arrow-right';
<ArrowRight className="w-5 h-5" />
Each icon becomes a tree-shaken component; only the icons you import ship. Works with Vite, webpack, Next.js, Nuxt, Svelte. Same name space as the search on this site, so lucide:arrow-right in the search is ~icons/lucide/arrow-right in code.
Option 3: SVG sprite
<svg class="hidden"><symbol id="i-arrow" viewBox="0 0 24 24">...</symbol></svg>
<svg width="20" height="20"><use href="#i-arrow"/></svg>
Best for server-rendered sites without a bundler: one cached file, no JavaScript. Downsides: harder to tree-shake and multi-color icons need CSS variables.
Option 4: inline SVG components
Paste the SVG from the download into a component (or run SVGR). Maximum control, but every icon is hand-maintained. Fine for fewer than 20 icons.
Accessibility
- Decorative icons:
aria-hidden="true"and no title. - Meaningful icons (an icon-only button):
aria-labelon the button, not the SVG. - Use
currentColorfor fill or stroke so icons follow text color and dark mode.
Sizing and alignment
Set width and height on the SVG (or a utility class), keep the viewBox from the source and align with vertical-align: -0.125em or flex centering next to text. Do not mix icon sets with different stroke widths on the same screen; see best free icon sets.
Animated icons
For hover and state animations, static SVG can be animated with CSS, but Lottie gives you designer-made motion with the same component approach (lottie-react). Examples: animated icon set. Integration recipes: how to add Lottie.
Keep reading
The 12 Best Free Icon Sets for UI Design in 2026 (SVG, MIT-Licensed)
Lucide, Tabler, Phosphor, Heroicons, Material Symbols, Iconoir, Remix, Solar, Fluent, Hugeicons and more compared by size, style, license and React support.
LicensingFree Icon Licenses Explained: MIT, Apache, CC BY, CC0 and OFL
What MIT, Apache 2.0, ISC, CC BY 4.0, CC0 and OFL actually allow for icons: commercial use, attribution, redistribution, logos. Plain-English guide.
AnimationLottie vs GIF vs SVG vs MP4: Which Animation Format to Use in 2026
File size, quality, interactivity and browser support compared for Lottie, GIF, animated SVG, APNG, WebP and MP4. Decision guide by a motion designer.
Looking for a motion designer?
Free Creative Assets is built by Serhii Dovhyi (Sergey Designer), a Top Rated Plus motion designer with 330+ delivered projects.