<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[SVGicons.com]]></title><description><![CDATA[Practical guides about SVG icons, icon systems, frontend workflows, accessibility, and choosing the right icon libraries for modern web projects.]]></description><link>https://svgiconscom.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/6a6e6c2e88aa17a5fe8f25bd/1b92c32f-2bef-4d55-9696-9e0dde8be99b.png</url><title>SVGicons.com</title><link>https://svgiconscom.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 02:59:53 GMT</lastBuildDate><atom:link href="https://svgiconscom.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to Use SVG Icons in React, Next.js, and Tailwind CSS]]></title><description><![CDATA[There are exactly three sensible ways to get an SVG icon into a React codebase: paste it inline as a component, import the file through a build transform like SVGR, or reference it from a sprite. Most]]></description><link>https://svgiconscom.hashnode.dev/how-to-use-svg-icons-in-react-next-js-and-tailwind-css</link><guid isPermaLink="true">https://svgiconscom.hashnode.dev/how-to-use-svg-icons-in-react-next-js-and-tailwind-css</guid><category><![CDATA[React]]></category><category><![CDATA[Next.js]]></category><category><![CDATA[Tailwind CSS]]></category><category><![CDATA[SVG]]></category><dc:creator><![CDATA[Marc EMILE]]></dc:creator><pubDate>Sat, 01 Aug 2026 22:56:31 GMT</pubDate><content:encoded><![CDATA[<p>There are exactly three sensible ways to get an SVG icon into a React codebase: paste it inline as a component, import the file through a build transform like SVGR, or reference it from a sprite. Most projects need only the first. This guide walks through the inline approach with Next.js and Tailwind specifics, and points to the deeper guides where a topic deserves its own article.</p>
<h2>Option 1: an inline JSX component</h2>
<p>Take a real icon from the catalog, convert the SVG attributes to JSX casing, and you have a dependency-free component. This is Lucide's search icon, exactly as it ships in the <a href="https://svgicons.com/icon-set/lucide-svg-icons">Lucide set</a>, wrapped for React:</p>
<pre><code class="language-jsx">export function SearchIcon(props) {
  return (
    &lt;svg
      xmlns="http://www.w3.org/2000/svg"
      viewBox="0 0 24 24"
      fill="none"
      stroke="currentColor"
      strokeLinecap="round"
      strokeLinejoin="round"
      strokeWidth={2}
      aria-hidden="true"
      {...props}
    &gt;
      &lt;path d="m21 21l-4.34-4.34" /&gt;
      &lt;circle cx="11" cy="11" r="8" /&gt;
    &lt;/svg&gt;
  );
}
</code></pre>
<p>The JSX gotchas are all attribute casing: <code>stroke-width</code> becomes <code>strokeWidth</code>, <code>stroke-linecap</code> becomes <code>strokeLinecap</code>, and <code>class</code> becomes <code>className</code>. Icon pages on this site do the conversion for you: every icon offers React, Vue, Svelte, and Solid snippets next to the raw SVG, so you can copy the JSX form directly. If you have a folder of SVG files instead, the free <a href="https://svgicons.com/tools/svg-to-component-converter">SVG to component converter</a> batch-converts them in the browser.</p>
<p>Prefer importing .svg files over pasting? That is the SVGR route, covered step by step in our <a href="https://svgicons.com/articles/use-svg-icons-in-react-with-vite-svgr">React with Vite and SVGR guide</a>.</p>
<h2>Next.js: server components by default</h2>
<p>An icon component like the one above has no state, no effects, and no event handlers, which makes it a perfect React Server Component. In the Next.js App Router it renders to static markup on the server and adds nothing to the client bundle:</p>
<pre><code class="language-jsx">import { SearchIcon } from "@/components/icons";

export default function DocsHeader() {
  return (
    &lt;label className="flex items-center gap-2"&gt;
      &lt;SearchIcon className="h-5 w-5 text-zinc-400" /&gt;
      &lt;input type="search" placeholder="Search docs" /&gt;
    &lt;/label&gt;
  );
}
</code></pre>
<p>Only add <code>"use client"</code> when the icon itself participates in interactivity, for example an animated toggle. A common Next.js mistake is marking a whole layout as client code just because one icon has a hover effect that CSS could have handled.</p>
<h2>Tailwind: size with utilities, color with currentColor</h2>
<p>Because well-drawn icon sets inherit <code>currentColor</code>, Tailwind's text color utilities style icons with no extra work. Size with <code>h-*</code> and <code>w-*</code>, color with <code>text-*</code>, and state variants compose naturally:</p>
<pre><code class="language-jsx">&lt;button className="group flex items-center gap-2 text-zinc-500 hover:text-zinc-900"&gt;
  &lt;SearchIcon className="h-4 w-4" /&gt;
  &lt;span&gt;Search&lt;/span&gt;
&lt;/button&gt;
</code></pre>
<p>The icon reads the button's text color, so hover, focus, dark mode, and disabled states all come from one utility change on the parent. The mechanics of currentColor theming, including CSS variables for multi-tone icons, are covered in our <a href="https://svgicons.com/articles/themeable-react-svg-icon-currentcolor">themeable icon components guide</a>. Stroke-drawn sets in the <a href="https://svgicons.com/icons/categories/ui-24px">UI 24px category</a>, like Lucide and Tabler, are drawn for exactly this workflow.</p>
<h2>Accessibility: decorative by default</h2>
<p>Most icons sit next to a visible label, and those should be hidden from assistive tech with <code>aria-hidden="true"</code>, as the component above does. An icon that carries meaning on its own, like an icon-only button, needs an accessible name on the interactive element instead:</p>
<pre><code class="language-jsx">&lt;button aria-label="Search" className="p-2"&gt;
  &lt;SearchIcon className="h-5 w-5" /&gt;
&lt;/button&gt;
</code></pre>
<p>The full decision tree, including when <code>role="img"</code> and <code>&lt;title&gt;</code> are the right tool, lives in our <a href="https://svgicons.com/articles/svg-icon-accessibility-guide">SVG icon accessibility guide</a>.</p>
<h2>When a sprite earns its keep</h2>
<p>Inline components are the right default, but a page that repeats the same icons hundreds of times, a data table with row actions for instance, can trim HTML weight with a sprite: define each shape once, reference it with <code>&lt;use&gt;</code>. The free <a href="https://svgicons.com/tools/svg-sprite-generator">SVG sprite generator</a> builds the symbol sheet from pasted icons, and directional glyphs from the <a href="https://svgicons.com/icons/concepts/arrow">arrow icons hub</a> are the classic candidates, since tables tend to repeat them most.</p>
<h2>Getting the icons themselves</h2>
<p>Any icon in the catalog can be copied as clean SVG or as a framework snippet from its page. When a project settles on its icon language, signed-in users can collect the chosen icons into an Icon Collection and export them together, which keeps a team from re-picking icons one pull request at a time. For choosing the set in the first place, our <a href="https://svgicons.com/articles/lucide-vs-tabler-vs-phosphor-icons">Lucide vs Tabler vs Phosphor comparison</a> covers the three most popular starting points.</p>
<p><em>This article was originally published on</em> <a href="https://svgicons.com/articles/use-svg-icons-react-nextjs-tailwind"><em>SVGicons.com.</em></a></p>
]]></content:encoded></item></channel></rss>