Why this converter exists
Search for “svg to react component” and the first result is the official SVGR playground; the rest of the page is third-party converters that already do client-side conversion, SVGO optimisation and batch ZIP export. Search for “svg to vue component” and you get a GitHub library, a handful of Stack Overflow answers and blog posts — but almost no tool you can just open and use. That asymmetry is the reason this page exists.
The second reason is that a naive converter hands you markup, not a component. A usable icon component needs four things that the paste-and-copy sites usually skip:
- Attribute passthrough. inheritAttrs: false plus v-bind="$attrs" means class, aria-label, @click and style all land on the root <svg> instead of vanishing inside an extra wrapper element.
- Themeable colour. Hard-coded hex values are rewritten to currentColor, so a single color declaration in CSS repaints the icon — including in dark mode.
- Collision-free ids. Gradients, masks and clip paths get their ids prefixed with the component name, so a whole icon set can share one page.
- Icon set pipeline. Point it at a folder: you get one .vue per icon plus an index.ts barrel for tree-shakeable imports, zipped and ready to commit.
Optimisation runs through SVGO in the browser, with removeViewBox deliberately left enabled so the size prop keeps working. If something in your source cannot be converted faithfully — inline <style> blocks, SMIL animation references, script tags — the tool tells you rather than silently generating broken code.