Convert SVG markup to a React component.
The SVG to JSX tool turns an SVG file's markup into a React component. It converts hyphenated attributes such as stroke-width to camelCase, can spread props onto the root svg element, and can add TypeScript types. It is useful for turning icons and illustrations from design tools into components.
SVG is an XML format for vector graphics, and browsers can embed it directly in a page. React can render inline SVG too, but JSX needs the attributes written in camelCase: stroke-width becomes strokeWidth, fill-rule becomes fillRule and class becomes className. Turning an icon into a component has two benefits. You can pass props such as width, height, className or aria-label to it, and you can style it with currentColor or CSS. A common pattern is a function that receives props and spreads them onto the root svg element, so the caller can override size and color. In TypeScript those props are usually typed as SVGProps<SVGSVGElement>. This tool performs that mechanical rewrite and wraps the result in a ready-to-export component.
This tool parses the input as strict XML. HTML parsing is more forgiving about unclosed tags and unquoted attributes, but XML is not.
Yes. A style string on any element becomes a style object with camelCase property names, as in the HTML to JSX tool.
Not directly. React Native needs a library such as react-native-svg with its own component names. This tool outputs DOM SVG elements for React on the web.
Yes, xmlns is kept as written. Other namespaced attributes are converted to camelCase.
No. The text is parsed in the page and stays on your device.