SVG to JSX Converter
Runs locallyConvert SVG markup into clean React TSX/JSX or Vue components with camelCase attributes.
What is SVG to JSX / React Converter?
Transform SVG icons into React JSX/TSX or Vue 3 components. Automatically converts kebab-case SVG attributes (`stroke-width`, `fill-rule`, `stop-color`), transforms inline `style=""` into JSX style objects, and optionally optimizes paths with SVGO first.
How to use SVG to JSX / React Converter
- Step 1
Paste raw SVG markup.
- Step 2
Choose React TSX, React JSX, or Vue 3 SFC and optional SVGO optimization.
- Step 3
Copy or download the component file.
Features
- Full camelCase attribute conversion and style object parsing
- Optional SVGO cleanup before component generation
- React TypeScript (`SVGProps<SVGSVGElement>`), JSX, and Vue 3 templates
- Instant sanitized preview
Example
Input
<svg viewBox="0 0 24 24"><path stroke-width="2" d="M4 12h16"/></svg>
Output
export function Icon(props: React.SVGProps<SVGSVGElement>) { ... strokeWidth="2" ... }Produces valid React TypeScript JSX ready for import.
Frequently asked questions
Does it convert inline style strings to JSX objects?
Yes, `style="stop-color:#fff"` becomes `style={{ stopColor: "#fff" }}`.
Can it optimize the SVG before generating JSX?
Yes, toggle SVGO optimization in Options.
Does it support TypeScript props?
Yes, TSX mode types `React.SVGProps<SVGSVGElement>`.
Is anything uploaded?
No, runs locally in your browser.
Related tools
SVG Optimizer
Optimize SVG with SVGO, preview safely and export SVG, React, Vue, Data URI or Android Vector.
SVG Viewer
Inspect sanitized SVG graphics with zoom, background toggle, dimensions and PNG export.
HTML Formatter & Validator
Beautify, minify, validate HTML, convert to JSX/Markdown and preview safely.