Skip to main content

SVG to JSX Converter

Runs locally

Convert 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

  1. Step 1

    Paste raw SVG markup.

  2. Step 2

    Choose React TSX, React JSX, or Vue 3 SFC and optional SVGO optimization.

  3. 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.