SVG to React and Vue Component Converter

Paste or open SVG files, strip editor junk, round numbers, and get ready-to-import React or Vue components with props, accessible titles and an index file.

Läuft in Ihrem Browser. Ihre Dateien verlassen nie Ihr Gerät. So prüfen Sie es

…

So geht's

  1. 1
    Add your icons

    Paste SVG markup into the source box, or press Open SVG files to load one or many files.

  2. 2
    Choose the output

    Pick React TSX, React JSX or Vue 3 SFC and set the number of decimals.

  3. 3
    Set the options

    Tick currentColor, remove width/height, size prop, title prop, forwardRef or memo as your project needs.

  4. 4
    Name the component

    Edit the component name field; it is turned into PascalCase automatically.

  5. 5
    Check the preview

    Look at the 24, 48 and 96 px previews and the size savings before copying.

  6. 6
    Export

    Copy or download the component or clean SVG, or press ZIP all for every icon plus an index file.

Über dieses Tool

Icons exported from Figma, Illustrator, Inkscape or Sketch carry a lot of baggage: XML declarations, editor namespaces, metadata blocks, unused ids, nested empty groups and coordinates with eight decimals. Pasting that straight into a React file also fails, because JSX wants className instead of class, strokeWidth instead of stroke-width and a style object instead of a style string. This converter does the clean-up and the conversion in one step. It keeps ids that gradients, masks or clip paths still reference, can replace hard-coded fills and strokes with currentColor so the icon follows the text colour, and writes a typed component with a size prop and an optional accessible title.

Who this is for

Front-end developers building an icon set, design-system maintainers, and anyone who copies SVGs from a design tool into a React, Next.js, Vite or Vue project.

What the optimiser removes

Comments, the XML prolog and doctype, metadata and title/desc blocks from the editor, sodipodi and inkscape elements and attributes, version and xml:space attributes, groups without attributes (their children move up), empty groups and empty defs, and ids nobody points to. Numbers in path data, points, transforms and coordinates are rounded to the number of decimals you choose; two decimals is invisible at icon sizes.

React output

Attributes are converted with React's rules: hyphenated names become camelCase, class becomes className, xlink:href becomes xlinkHref, and inline style strings become style objects. The root svg receives width and height from a size prop (default 1em, so the icon scales with font size), and every other prop is spread onto the element, so onClick, className and aria attributes still work. TSX output types the props as SVGProps of SVGSVGElement. forwardRef and memo wrappers are optional.

Vue output

The Vue target writes a single-file component with a template and a script setup block. Attributes stay in their SVG spelling, which Vue templates accept, size and title become typed props with defaults, and attributes passed by the parent fall through to the root svg automatically.

Accessibility

Decorative icons get aria-hidden="true". Turn on the title prop for icons that carry meaning, such as a lone delete button icon; the component then renders a title element linked through aria-labelledby with a generated id, which screen readers announce.

Batch work

Open many SVG files at once. Each becomes its own tab, the batch table shows size savings and any errors, and ZIP all downloads every component plus an index file that re-exports them by name.

Worked example

A 941-byte Sketch export of an arrow icon contains a comment, a title, two nested groups with ids and coordinates such as 13.2928932. With two decimals, currentColor and the size prop, the clean SVG is 489 bytes (48 % smaller), and the TSX component ArrowRight renders at 24, 48 and 96 px in the preview with the fill following the text colour.

Limits

The optimiser is conservative: it does not merge paths, convert shapes to paths or remove hidden elements, so a dedicated tool such as SVGO can shrink complex art further. Embedded scripts and foreign objects are not checked for safety. Animations written in SMIL are kept as they are.

Rechenbeispiel

arrow-right.svg (941 bytes from Sketch) → ArrowRight.tsx with a size prop, 48 % smaller SVG markup.

Kurzinfos

Häufig gestellte Fragen

Why does the icon not change colour with my CSS?

Turn on Colours → currentColor. Fills and strokes that are not none or url(...) are then replaced, so the icon uses the colour property of its parent.

Will gradients and masks still work?

Yes. Ids that are referenced through url(#id) or href="#id" are kept; only ids nobody uses are removed.

What does the size prop do?

It sets width and height together. The default 1em makes the icon as tall as the surrounding text; pass a number for pixels.

Can I use the output with Next.js or Vite?

Yes. The components are plain React or Vue files with no runtime dependency beyond the framework itself.

Should decorative icons have a title?

No. Decorative icons should be hidden from screen readers with aria-hidden, which the converter adds when the title prop is off.

Are my SVG files uploaded?

No. Parsing, optimising and zipping happen in your browser, and the preview uses an image tag so scripts inside an SVG never run.

Völlig kostenlosKeine Kosten, keine Anmeldung
Dateien bleiben privatAlles läuft in Ihrem Browser
Einfach in Ihrer SpracheIn vielen Sprachen verfügbar