JSON to Dart Class
Generate Dart model classes with fromJson and toJson from a sample payload.
Turn an SVG into a React component with the attributes React expects.
The SVG to JSX converter fixes the hyphenated presentation attributes and the case-sensitive viewBox that silently break an inlined icon, then makes the result useful by spreading props and offering currentColor.
SVG has more hyphenated attributes than HTML, and every one of them is a JSX error waiting to happen: stroke-width, stroke-linecap, fill-rule, clip-path, and the case-sensitive viewBox that a lowercase viewbox silently breaks.
This converts all of them, wraps the result in a component, and makes it useful rather than merely valid. Props are spread onto the root element so the icon can take a className or a size from wherever it is used, and fill or stroke can be switched to currentColor in one option — which is what makes an icon inherit the text colour around it instead of being stuck at whatever the designer exported.
A lowercase viewbox is ignored entirely and nothing warns you — which is why the icon scales wrongly and the cause is so hard to find.
stroke-width, stroke-linecap, fill-rule, clip-path and the rest, each camelCased the way React expects.
Switch fill or stroke to currentColor and the icon follows the surrounding text colour, including on hover.
So the component can take a className, a size or an aria-label where it is used rather than being fixed at export time.
The output is a complete named export, not a fragment you have to wrap yourself.
Straight from a design tool, an icon set or a file.
Something like ChevronIcon; the export is named for it.
Switch fill or stroke to currentColor so the icon follows the surrounding text.
Paste it into a file and use it like any other component.
Because SVG attributes are case-sensitive and JSX passes them through as written. A lowercase viewbox is ignored entirely, which is why the icon scales wrongly and nothing warns you.
It makes the shape take the CSS color value of its context, so an icon inside a link turns the link colour on hover automatically. It is the single most useful change to make to an exported icon.
So the component can be given a className, a width, an aria-label or an event handler where it is used, rather than being fixed at whatever the export produced.
Inline when you need to style it — colour, hover states, animation. An img tag when it is a fixed illustration, since that keeps it out of your bundle and lets the browser cache it separately.
What people who use the SVG to JSX think of it. Reviews come from visitors and are posted as written.
No ratings yet
Yours would be the first.
0 reviews
Newest first
No reviews yet
Be the first to rate the SVG to JSX. It takes half a minute and no account.
Write the first reviewGenerate Dart model classes with fromJson and toJson from a sample payload.
Build an accessible HTML table from pasted data or by hand.
Convert a name between camelCase, snake_case, kebab-case and the rest.
Build an HTTP Basic Authorization header from a username and password.
Generate HMAC signatures with SHA-1, SHA-256, SHA-384 or SHA-512.
Flatten a JSON config into .env lines with correct quoting and naming.
Re-indent a stylesheet, or strip it back to one line.
Percent-encode URLs and query strings, or decode them back to plain text.