What this SVG converter does
SVG files exported from Figma, Illustrator, Sketch or Inkscape are valid XML, but they are not valid JSX. React expects camelCase props such as strokeWidth instead of stroke-width, className instead of class, and a style object instead of a CSS string. Editors also add XML declarations, comments, metadata blocks and namespaced attributes that bloat your bundle and trigger warnings.
SvgJsx parses the SVG with a small XML parser, rewrites every attribute to the form your framework expects and prints a formatted component. You can choose TypeScript types, a size prop, currentColor fills, forwardRef, memo and the export style, then copy the code or download a file.
How to convert SVG to a React component
The workflow takes a few seconds:
- Paste the SVG code into the input box, or drop one or more .svg files onto it.
- Pick the output format: React, React Native, Vue, Solid or a plain JSX snippet.
- Set the component name and options such as TypeScript, currentColor and the size prop.
- Check the live preview and the size comparison, then copy the code or download the file. Several files are bundled into a ZIP.
Conversions applied automatically
Hyphenated attributes become camelCase (stroke-linecap → strokeLinecap), namespaced attributes are flattened (xlink:href → xlinkHref), and inline style strings become JavaScript objects. data-* and aria-* attributes are kept unchanged because React accepts them as they are. Script elements and inline event handlers are removed so a pasted file can never smuggle code into your app.
A light optimisation pass collapses whitespace and can round coordinates to a fixed number of decimals. For most icon sets that cuts 20–40% of the markup without a heavy SVGO dependency.