Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>HTML to React (JS)New to Visual Studio Code? Get it now.
HTML to React (JS)

HTML to React (JS)

Ganesh Wayal

|
48 installs
| (0) | Free
Instantly convert selected HTML/CSS into clean React JSX components using JavaScript.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

⚛️ HTML to React (JS)

Visual Studio Marketplace Installs Rating

The most advanced and robust HTML to JSX converter for VS Code.
Instantly convert complex HTML, SVG, and CSS into clean, functional React components with a single click.


✨ Why this extension?

Most simple converters use brittle regex that fails on complex HTML or breaks your text content. This extension uses a smart parsing engine designed for modern web development.

🛡️ Smart Parsing

  • Preserves Content: Text content remains untouched (e.g., <div>class</div> stays <div>class</div>).
  • Nested Structures: Perfectly handles deeply nested tags and complex layouts.
  • Escape Logic: Automatically escapes curly braces {} and other JSX-restricted characters in text content.

🎨 Premium Features

  • Style Magic: Automatically transforms inline CSS into React-ready style objects.
  • Form Intelligence: Converts value ➡️ defaultValue, checked ➡️ defaultChecked, and class ➡️ className.
  • Full SVG Support: Full camelCase conversion for all SVG and ARIA attributes.
  • Clipboard/File Workflow: Copy directly to clipboard or save as a new .jsx/.tsx file.

🚀 Key Features

Feature Description
Smart Attributes class ➡️ className, for ➡️ htmlFor, and camelCase for events like onclick.
SVG Power Seamlessly converts stroke-width, fill-rule, and 100+ other SVG attributes.
Boolean Logic Handles checked, disabled, readonly correctly for JSX.
Void Tags Automatically closes <br>, <img/>, <input/>, etc.
Comments <!-- --> ➡️ {/* */} translation.
Advanced UI New dedicated Webview for real-time preview, TypeScript options, and state generation (Command: HTML to React: Advanced UI).
Customizable Choose between Arrow Functions and Function Declarations.

📖 How to Use

  1. Select any HTML/SVG code in your editor.
  2. Right-click and choose "Create to JSX" (or use Cmd+Alt+R / Ctrl+Alt+R).
  3. Enter a name for your component (e.g., Navbar).
  4. Choose: Save to a new file or Copy to Clipboard.

💡 Examples

1. Complex Form Elements

Input:

<div class="form-group">
  <input type="text" value="Hello" class="input" style="color: blue;" disabled>
  <label for="id">Label</label>
</div>

Output:

import React from 'react';

const Navbar = (props) => {
  return (
    <>
      <div className="form-group">
        <input type="text" defaultValue="Hello" className="input" style={{ color: 'blue' }} disabled />
        <label htmlFor="id">Label</label>
      </div>
    </>
  );
};

export default Navbar;

2. SVG Icons

Input:

<svg stroke-width="2" fill-rule="evenodd">
  <circle cx="12" cy="12" r="10" />
</svg>

Output:

<svg strokeWidth="2" fillRule="evenodd">
  <circle cx="12" cy="12" r="10" />
</svg>

⚙️ Configuration

You can customize the extension behavior in your settings.json:

  • htmlToReact.componentType: "Arrow Function" (default) or "Function Declaration"
  • htmlToReact.fileExtension: ".jsx" (default) or ".tsx"
  • htmlToReact.defaultDirectory: Target folder (e.g., "src/components")
  • htmlToReact.autoFormat: Automatically format the file after creation (Prettier recommended)

👨‍💻 Author

Ganesh Wayal
GitHub | Marketplace


Enjoying the extension?
Please leave a review to help others find it! ⭐⭐⭐⭐⭐

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft