JSX output
—
Converts class, for, tabindex, hyphenated SVG attributes, inline event handlers, void tags, and HTML comments. It is a text transform, so run your formatter afterwards and check any component-specific props by hand.
About the HTML to JSX
The HTML to JSX Converter rewrites copied markup for React. It renames class to className, for to htmlFor, converts inline styles to objects, closes void elements, and camel-cases hyphenated attributes.
Turning a design mockup or email template into a React component starts with this conversion. Run Prettier afterwards so indentation and long attribute lists settle into a consistent shape.
- ✓className and htmlFor conversion
- ✓Style strings to style objects
- ✓Self-closing void elements
How to use the HTML to JSX
- 1
Paste the HTML snippet.
- 2
Choose how styles and void tags are handled.
- 3
Copy the JSX into your component.
Frequently asked questions
Why are my SVG attributes changed?+
JSX uses camelCase for most hyphenated attributes, such as strokeWidth. Some SVG attributes keep their hyphenated names, so review the output before committing.
Does it handle components?+
No. It is a text transform for plain HTML. Custom elements and framework directives need manual changes.
Save HTML to JSX to your favorites, or keep browsing developer tools.
Browse all 35 developer tools →