Skip to content

SVG to React Component

Embed

Paste this where you want SVG to React Component on your site. Adjust the height to fit.

<iframe src="https://www.browserutils.dev/embed/svg-to-react/" width="100%" height="500" frameborder="0" loading="lazy" title="SVG to React Component"></iframe>
<p style="font-size:12px;margin:4px 0 0"><a href="https://www.browserutils.dev/tools/svg-to-react/">SVG to React Component</a> by BrowserUtils</p>

Convert SVG markup to React components.Runs in this tab.

Next step

About SVG to React Component

Free online SVG to React component converter. Transform SVG markup into a React functional component with proper JSX attributes, TypeScript support, and customizable props. It runs in your browser. Nothing is sent to a server.

Questions

What SVG attributes are converted?
All kebab-case SVG attributes are converted to camelCase JSX equivalents: stroke-width→strokeWidth, fill-rule→fillRule, clip-path→clipPath, class→className, and inline styles become JSX objects.
Does it support TypeScript?
Yes, toggle TypeScript mode to generate a component with SVGProps<SVGSVGElement> typing and proper React.FC type annotations.
Is the SVG to React converter safe for proprietary icons?
Yes, all conversion runs in your browser. No SVG code is sent to any server, so your custom icons and design assets stay private.
Can I pass custom props like color and size to the generated component?
Yes, the generated component spreads props onto the root SVG element, so you can pass width, height, fill, className, and any other valid SVG attributes when using the component.
How is SVG to React different from HTML to JSX?
SVG to React wraps the converted markup in a functional component with proper imports and prop spreading. HTML to JSX only converts the markup syntax without creating a component wrapper.

More in Code Generators

All 26 code generators