Transform natural language into production-ready React components in seconds
An AI-powered UI component generator that transforms natural language into production-ready React components with live preview and code editing.
Traditional component development is slow. ComponentLab lets you:
- โก Generate components 10x faster than coding from scratch
- ๐จ Prototype UI ideas instantly without leaving your workflow
- ๐ Iterate with natural language instead of tweaking CSS
- ๐ฆ Export to CodeSandbox or copy production-ready code
- ๐งช Test ideas in real-time with live Sandpack preview
| Feature | Description |
|---|---|
| ๐ค Natural Language to Code | Describe a component, get working React + Tailwind code instantly |
| ๐๏ธ Live Preview | See your component render in real-time as it's generated |
| โ๏ธ In-Browser Code Editor | Edit code with syntax highlighting powered by Sandpack |
| ๐ Iterative Refinement | Keep editing with follow-up prompts ("make it darker", "add hover effect") |
| ๐ค Export to CodeSandbox | One-click export to continue working in a full IDE |
| ๐ Copy Code | Grab the generated code instantly for your projects |
๐ Try ComponentLab Now
Get inspired with these example prompts:
โจ "A pricing card with a title, price, 3 features, and a CTA button"
๐๏ธ "A toggle switch that shows ON/OFF with smooth animation"
๐ซ๏ธ "A glassmorphism login form with blur effect"
๐ "A dark mode card with hover effects and a gradient border"
๐ "A dashboard stat card with an icon, metric number, and percentage change"
- Node.js 18+
- OpenAI API key (Get one here)
1. Clone the repository
git clone https://github.com/Riashabh/ComponentLab.git
cd ComponentLab2. Install dependencies
# Frontend
cd client
npm install
# Backend
cd ../server
npm install3. Configure OpenAI API
# In /server, create .env file
echo "OPENAI_API_KEY=your-key-here" > .env4. Start both servers
# Terminal 1 - Backend (Port 3000)
cd server
npm start
# Terminal 2 - Frontend (Port 5173)
cd client
npm run dev5. Open your browser
Navigate to localhost:5173
ComponentLab/
โโโ client/ # React frontend
โ โโโ src/
โ โ โโโ App.jsx # Main app with Sandpack integration
โ โ โโโ components/ # Reusable UI components
โ โ โโโ assets/ # Static assets
โ โโโ public/
โ โโโ package.json
โโโ server/ # Express backend
โ โโโ server.js # API endpoint for code generation
โ โโโ .env # OpenAI API key (not committed)
โ โโโ package.json
โโโ demo.gif # Demo recording
โโโ README.md
- Component History โ Save and version your generated components
- Share via URL โ Generate unique shareable links for components
- Multi-Framework Support โ Add Vue, Svelte, and Angular output
- AI Chat Sidebar โ Get real-time explanations and suggestions
- Component Library โ Browse and reuse community components
- Dark Mode Toggle โ Built-in dark mode for the editor
- Export to Figma โ Convert components to Figma designs
Contributions are welcome! Feel free to open issues or submit pull requests.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Rishabh Meena
- ๐ Website: rishabh.dev (if you have one)
- ๐ผ LinkedIn: @meenarishabh35
- ๐ GitHub: @Riashabh
- ๐ง Email: your.email@example.com (optional)
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenAI for the GPT-4 API
- CodeSandbox for the Sandpack editor
- Vercel for frontend hosting
- Render for backend hosting
Rishabh Meena
