SVG to JSX Converter

Paste SVG code → instant React/JSX component. Auto camelCase, currentColor, TypeScript, and more.

import React from "react";

export default function MyIcon(props: React.SVGProps<SVGSVGElement>) {
  return (
  <svg {...props} xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
    <path d="M20 6 9 17l-5-5"/>
  </svg>
);
}

Last updated: March 2026

Frequently Asked Questions

Why convert SVG to JSX?

React can't render raw SVG with kebab-case attributes like stroke-width or fill-rule. JSX requires camelCase (strokeWidth, fillRule). Also, inline styles must be objects, class becomes className, and you often want the SVG to accept props. This tool handles all that transformation in one paste.

What does 'currentColor' do?

Replacing fill or stroke with currentColor lets the icon inherit the text color of its parent. This makes icons trivially themeable — change the color of a button or link, and the icon follows. Most modern icon libraries use this pattern.

Does this support TypeScript?

Yes. Toggle TypeScript to emit .tsx output with SVGProps<SVGSVGElement> props typing. You can also toggle React.FC wrapping if you prefer that pattern, though React team now recommends function declarations without FC.

Can I spread props onto the SVG?

Yes — the converter automatically injects {...props} onto the root svg element so you can pass className, style, width, height, or any SVG attribute from the parent.

Is my SVG sent to any server?

No. Everything runs in your browser. Paste, convert, copy — no upload, no tracking.

Related Tools

Need help? Email us