Skip to content

Riashabh/ComponentLab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

20 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

ComponentLab โšก

Transform natural language into production-ready React components in seconds

Live Demo License React OpenAI

ComponentLab Demo

An AI-powered UI component generator that transforms natural language into production-ready React components with live preview and code editing.


๐ŸŽฏ Why ComponentLab?

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

โœจ Features

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

๐Ÿ› ๏ธ Tech Stack

Frontend

React Vite TailwindCSS Sandpack

Backend

Express Node.js OpenAI

Deployment

Vercel Render


๐Ÿš€ Live Demo

๐Ÿ‘‰ Try ComponentLab Now


๐Ÿ’ก Example Prompts

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"

๐Ÿ“ฆ Run Locally

Prerequisites

Setup

1. Clone the repository

git clone https://github.com/Riashabh/ComponentLab.git
cd ComponentLab

2. Install dependencies

# Frontend
cd client
npm install

# Backend
cd ../server
npm install

3. Configure OpenAI API

# In /server, create .env file
echo "OPENAI_API_KEY=your-key-here" > .env

4. Start both servers

# Terminal 1 - Backend (Port 3000)
cd server
npm start

# Terminal 2 - Frontend (Port 5173)
cd client
npm run dev

5. Open your browser

Navigate to localhost:5173


๐Ÿ“ Project Structure

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

๐Ÿ”ฎ Roadmap & Future Improvements

  • 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

๐Ÿค Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ‘ค Author

Rishabh Meena


๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ™ Acknowledgments


Rishabh Meena

Star on GitHub

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors