Convert SVG into a React component. Paste an icon and get JSX or TypeScript with attributes camelCased, className and style objects fixed, props spread onto the root and, if you like, the fixed size removed so CSS can scale it. Drop a whole folder of icons to get one component per file plus an index, as a ZIP. It's free, runs in your browser, and nothing is uploaded.
| SVG | JSX |
|---|---|
| class | className |
| stroke-width="2" | strokeWidth={2} |
| fill-rule | fillRule |
| clip-path | clipPath |
| xlink:href | xlinkHref |
| style="fill:red" | style={{ fill: "red" }} |
Attributes like stroke-width, fill-rule and class must be strokeWidth, fillRule and className in React.
Passing {...props} to the svg lets you set className, width, aria-label or onClick when you use the icon.
Yes, if you want to size icons with CSS. Keep viewBox so it scales correctly.
Yes. Drop a folder of SVGs to get a ZIP with one component per icon and an index file.
No. Conversion happens in your browser.
The SVG is parsed with the browser's XML parser, which rejects malformed markup instead of guessing, and walked into JSX. Hyphenated presentation attributes become camelCase (stroke-width to strokeWidth, fill-rule to fillRule, clip-path to clipPath), namespaced ones follow React's names (xlink:href to xlinkHref, xmlns:xlink to xmlnsXlink), class becomes className, inline styles become objects, and data- and aria- attributes are left alone. Purely numeric values are written as numbers in braces, which is how hand-written icon components usually look. The result is wrapped in a function component, optionally typed with React.SVGProps<SVGSVGElement>, with {...props} spread on the root after the other attributes so callers can override them, and with the fixed width and height removable so the icon scales with CSS. A whole folder of SVGs can be converted at once: file names become PascalCase component names ending in Icon, and the ZIP includes an index file that re-exports them all.