Skip to content

redflagrul/Sketch2Code-

Repository files navigation

Sketch2Code+ 🎨➡️💻

A comprehensive web-based drawing-to-code interface that transforms visual designs into clean, production-ready code in real-time.

✨ Features

🎨 Visual Design Interface

  • Interactive Canvas: Draw directly on an HTML5 canvas with grid support
  • Shape Tools: Rectangle, Circle, Text, Image, and Button elements
  • Real-time Preview: See your design come to life as you draw
  • Smart Selection: Click to select, drag to move, resize with handles

🛠️ Advanced Editing

  • Inspector Panel: Modify properties, layout, and styles in real-time
  • Precise Controls: Set exact positions, dimensions, colors, and typography
  • Layer Management: Z-index control for proper element stacking
  • Quick Shapes: Pre-built components like Hero sections, Cards, Buttons

💻 Code Generation

  • Multi-Framework Support: HTML, React, Vue.js, Angular
  • CSS Frameworks: Vanilla CSS, Tailwind, Bootstrap, Bulma
  • Live Code Preview: See generated code update in real-time
  • Syntax Highlighting: Beautiful code display with copy functionality

📱 Responsive Design

  • Multi-Device Preview: Desktop, Tablet, Mobile viewports
  • Responsive CSS: Auto-generated media queries
  • Grid System: Smart layout detection and positioning

🚀 Export Options

  • Multiple Formats: Download as HTML, CSS, JS files
  • Framework-Specific: Export React components, Vue templates
  • Customizable Output: Minification, comments, and optimization options

🚀 Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation

# Install dependencies
npm install

# Start development server
npm run dev

Open http://localhost:3000 in your browser.

🎯 How to Use

1. Design Phase

  • Select tools from the left toolbar
  • Click on canvas to add elements
  • Use Quick Shapes for common components
  • Drag elements to reposition
  • Resize using corner handles

2. Customize Phase

  • Select any element to open Inspector
  • Modify properties, layout, and styles
  • Adjust colors, typography, and spacing
  • Set responsive behavior

3. Code Generation

  • View generated code in real-time
  • Switch between HTML, CSS, and JS tabs
  • Use Preview tab to see live result
  • Copy code snippets or export entire project

4. Export Phase

  • Click "Export Settings" to configure output
  • Choose framework and CSS library
  • Enable/disable comments and minification
  • Download complete project files

🏗️ Architecture

Frontend Stack

  • Next.js 15: React framework with App Router
  • TypeScript: Type-safe development
  • Tailwind CSS: Utility-first styling
  • Lucide React: Beautiful icons

Key Components

  • Canvas: HTML5 canvas with drawing and interaction logic
  • Toolbar: Shape tools and quick components
  • Inspector: Property editor with real-time updates
  • CodePreview: Syntax-highlighted code display
  • Header: Export controls and responsive preview

Code Generation

  • Smart HTML Generation: Semantic markup based on element types
  • CSS Optimization: Clean, maintainable stylesheets
  • Framework Adapters: Convert to React, Vue, Angular
  • Responsive Logic: Auto-generated media queries

🎨 Supported Elements

Element Description Properties
Rectangle Basic container/div Position, size, background, border, radius
Circle Circular elements Position, size, background, border
Text Text content Content, font, size, color, alignment
Button Interactive buttons Content, styling, hover effects
Image Image placeholders Source URL, dimensions, object-fit

🔧 Advanced Features

Smart Layout Detection

  • Automatically suggests Flexbox/Grid layouts
  • Detects common UI patterns
  • Optimizes positioning for responsiveness

Code Quality

  • Semantic HTML structure
  • BEM CSS methodology
  • Accessibility considerations
  • Performance optimizations

Export Formats

  • HTML/CSS/JS: Vanilla web files
  • React: JSX components with hooks
  • Vue: Single File Components
  • Angular: Component templates

🎯 Use Cases

  • Rapid Prototyping: Quickly mock up UI designs
  • Design Handoff: Convert designs to developer-ready code
  • Learning Tool: Understand how visual designs translate to code
  • Client Presentations: Show interactive prototypes
  • Code Generation: Automate repetitive HTML/CSS writing

🛣️ Roadmap

  • Advanced Shapes: Lines, arrows, polygons
  • Component Library: Reusable design components
  • Collaboration: Real-time multi-user editing
  • Version Control: Design history and branching
  • AI Integration: Smart layout suggestions
  • Plugin System: Extensible architecture
  • Cloud Storage: Save and sync projects
  • Advanced Export: Figma, Sketch integration

Sketch2Code+ - Bridging the gap between design and development! 🌉

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages