Skip to content
Toolwright

SVG to React

SVG to React converts an SVG into a React component with the right attribute names, style objects and optional TypeScript, props, currentColor and memo, and drops editor junk. It runs in your browser, so your SVG is never uploaded.

Tool 116 · Developer
Outside requests …How to checkRuns on this deviceWorks offline once opened

How to use SVG to React

  1. Paste your SVG or drop the file.
  2. Name the component and choose JavaScript or TypeScript.
  3. Copy the component into your project.

Frequently asked questions

Is my SVG uploaded?

No. The conversion runs in your browser and nothing is sent anywhere.

What changes besides attribute names?

class becomes className, stroke-width becomes strokeWidth, inline style strings become objects, and comments, the XML declaration, editor namespaces and metadata are removed. A note under the result lists what was changed.

How do I make the icon take the text colour?

Turn on Use currentColor. Fills and strokes then use the colour of the surrounding text, so you can change it with CSS.

Does it work with Next.js, Vite and React Native?

The output is standard JSX and TSX, so it works with Next.js and Vite. React Native needs react-native-svg components instead, which this tool does not produce.

Next step

Smaller components start with a smaller SVG. Optimize it first. Open SVG Optimizer.

  1. 110

    SVG Optimizer

  2. 108

    SVG to Data URI

  3. 109

    SVG Editor

  4. 040

    HTML to Markdown Converter