Why convert SVG to a React component?
Raw SVG inside a React app has a few quirks: `class` must be `className`, hyphenated attributes (`stroke-width`) become camelCase, color is hardcoded into the SVG. If you want to render the same icon in a different color, you need a second file. A different size? Another file, or a CSS override.
A React component with props handles this neatly: `<IconCheck size={20} color="red" />`. One file, any color, any size. Plus `...props` forwarding - drop in `aria-label` or `onClick` without changing the component.
Paste your SVG (Figma, Iconify, your own art), pick options (TypeScript vs JSX, named vs default export, whether you want a `color`/`size` prop) and get a ready-to-copy component. Download as `.tsx` with a correct filename or copy to clipboard.
How to use
- Paste SVG code in the left panel. Can be an icon (24x24), a logo, an illustration - any SVG.
- Enter a component name (PascalCase, e.g. `IconCheck`, `LogoBrand`).
- Toggle options: TypeScript for a typed version, default export or named.
- On the right you get the ready component. Below it a live preview with the current size and color.
- Hit "Copy" to copy the code or "Download .tsx" to save the file with the right name.
When this helps
Practical use cases:
- Icon library in a project. The designer exports 30 icons from Figma, you convert each one and end up with `components/icons/` full of `.tsx` files. Every icon has size/color props and is theme-aware.
- Company logo. Export from Illustrator, convert, you get `<LogoBrand size={32} />` for the header, footer, social embeds.
- Status icons. `<IconSuccess color="green" />`, `<IconError color="red" />` - one file, different colors per state.
- Custom hero illustrations. An SVG illustration in the hero section - now a component with editable accent colors.
- A replacement for lucide-react / heroicons. Sometimes you need an icon that no library ships. Convert your own.
- Build-time SVG. In Next.js a component beats `<Image src="/icon.svg" />` - fewer requests, better SSR.
- Prop forwarding. `<IconClose onClick={handleClose} aria-label="Close modal" />` - accessibility and interaction in one.
First shrink your SVG with the SVG optimizer. For HTML to JSX see the HTML to JSX converter.