Screenshot to Code
Convert UI screenshots into production-ready code with accurate styling and structure.
How This Works
Given a screenshot of a UI design:
- Analyze the visual design thoroughly
- Generate clean, modern code that recreates it
- Provide complete, runnable implementation
Instructions
1. Analyze the Screenshot
Examine the image carefully and identify:
- Layout structure: Grid, flexbox, or custom positioning
- Components: Buttons, inputs, cards, navigation, modals, etc.
- Visual details: Colors, fonts, spacing, borders, shadows, borders-radius
- Responsive considerations: Mobile vs. desktop layout cues
2. Determine the Framework
Ask which framework is preferred:
- React (with Tailwind CSS or styled-components)
- Vue.js
- Plain HTML/CSS
- Next.js
Default: If not specified, use React with Tailwind CSS for modern designs, or plain HTML/CSS for simple pages.
3. Generate Complete Code
Create the implementation:
For React/Vue:
- Build component hierarchy (break into logical components)
- Use semantic HTML elements
- Implement modern CSS (flexbox, grid, custom properties)
- Include prop types and sensible defaults
For HTML/CSS:
- Use semantic HTML5 structure
- Write clean, organized CSS (consider using BEM naming)
- Make it responsive by default
Critical requirements:
- Match colors EXACTLY (extract hex codes from screenshot)
- Match spacing and proportions as closely as possible
- Use appropriate semantic elements (header, nav, main, section, etc.)
- Include accessibility attributes (alt text, ARIA labels where needed)
4. Make It Responsive
- Use responsive units (rem, em, %, vw/vh) rather than fixed pixels
- Add breakpoints for mobile, tablet, desktop if the design suggests it
- Use
min(), max(), clamp() for fluid typography where appropriate
5. Deliver Complete Implementation
Provide:
- Complete code (all files needed, fully functional)
- File structure (explain what each file does)
- Usage instructions (how to run/use the code)
- Notes on design decisions (any assumptions or interpretations)
Output Format
Structure React + Tailwind output like this:
import React from 'react';
export default function ComponentName() {
return (
<div className="...">
{/* Component structure */}
</div>
);
}
Always include:
- All necessary imports
- Any required dependencies
- Clear comments for complex sections
- Suggestions for improvements or next steps
Best Practices
- Accuracy: Match the design as closely as possible
- Modern CSS: Prefer Grid/Flexbox over floats or tables
- Accessibility: Include ARIA labels, alt text, semantic HTML
- Performance: Optimize images, use efficient selectors
- Maintainability: Write clean, well-organized code with comments
- Responsiveness: Design mobile-first when possible
Common Patterns
Navigation Bars: Flexbox with space-between, sticky positioning
Card Grids: CSS Grid with auto-fit/auto-fill for responsiveness
Hero Sections: Full-height with centered content, background images
Forms: Proper labels, validation states, accessible inputs
Modals: Fixed positioning, backdrop, focus management
Handling Unclear Screenshots
When the screenshot is unclear or ambiguous:
- Make reasonable assumptions based on common UI patterns
- Note the chosen interpretation in comments
- Suggest alternatives that might be preferred
- Ask for clarification on critical decisions
Example Workflow
Input: Screenshot of a landing page with hero section, feature cards, and footer
Response:
- Analyze: Hero with large headline, 3-column feature grid, simple footer
- Ask: "Would you like this in React with Tailwind or plain HTML/CSS?"
- Generate: Complete implementation with responsive design
- Deliver: All code files with clear structure and usage instructions
Aim to produce code so clean and accurate that it could be deployed immediately with minimal modifications.
1---2name: screenshot-to-code3description: Convert UI screenshots into working HTML/CSS/React/Vue code. Detects design patterns, components, and generates responsive layouts. Use this when users provide screenshots of websites, apps, or UI designs and want code implementation.4---56# Screenshot to Code78Convert UI screenshots into production-ready code with accurate styling and structure.910## How This Works1112Given a screenshot of a UI design:131. Analyze the visual design thoroughly142. Generate clean, modern code that recreates it153. Provide complete, runnable implementation1617## Instructions1819### 1. Analyze the Screenshot2021Examine the image carefully and identify:22- **Layout structure**: Grid, flexbox, or custom positioning23- **Components**: Buttons, inputs, cards, navigation, modals, etc.24- **Visual details**: Colors, fonts, spacing, borders, shadows, borders-radius25- **Responsive considerations**: Mobile vs. desktop layout cues2627### 2. Determine the Framework2829Ask which framework is preferred:30- React (with Tailwind CSS or styled-components)31- Vue.js32- Plain HTML/CSS33- Next.js3435**Default**: If not specified, use **React with Tailwind CSS** for modern designs, or **plain HTML/CSS** for simple pages.3637### 3. Generate Complete Code3839Create the implementation:4041**For React/Vue:**42- Build component hierarchy (break into logical components)43- Use semantic HTML elements44- Implement modern CSS (flexbox, grid, custom properties)45- Include prop types and sensible defaults4647**For HTML/CSS:**48- Use semantic HTML5 structure49- Write clean, organized CSS (consider using BEM naming)50- Make it responsive by default5152**Critical requirements:**53- Match colors EXACTLY (extract hex codes from screenshot)54- Match spacing and proportions as closely as possible55- Use appropriate semantic elements (header, nav, main, section, etc.)56- Include accessibility attributes (alt text, ARIA labels where needed)5758### 4. Make It Responsive5960- Use responsive units (rem, em, %, vw/vh) rather than fixed pixels61- Add breakpoints for mobile, tablet, desktop if the design suggests it62- Use `min()`, `max()`, `clamp()` for fluid typography where appropriate6364### 5. Deliver Complete Implementation6566Provide:671. **Complete code** (all files needed, fully functional)682. **File structure** (explain what each file does)693. **Usage instructions** (how to run/use the code)704. **Notes on design decisions** (any assumptions or interpretations)7172## Output Format7374Structure React + Tailwind output like this:7576```jsx77import React from 'react';7879export default function ComponentName() {80 return (81 <div className="...">82 {/* Component structure */}83 </div>84 );85}86```8788Always include:89- All necessary imports90- Any required dependencies91- Clear comments for complex sections92- Suggestions for improvements or next steps9394## Best Practices9596- **Accuracy**: Match the design as closely as possible97- **Modern CSS**: Prefer Grid/Flexbox over floats or tables98- **Accessibility**: Include ARIA labels, alt text, semantic HTML99- **Performance**: Optimize images, use efficient selectors100- **Maintainability**: Write clean, well-organized code with comments101- **Responsiveness**: Design mobile-first when possible102103## Common Patterns104105**Navigation Bars**: Flexbox with space-between, sticky positioning106**Card Grids**: CSS Grid with auto-fit/auto-fill for responsiveness107**Hero Sections**: Full-height with centered content, background images108**Forms**: Proper labels, validation states, accessible inputs109**Modals**: Fixed positioning, backdrop, focus management110111## Handling Unclear Screenshots112113When the screenshot is unclear or ambiguous:114- Make reasonable assumptions based on common UI patterns115- Note the chosen interpretation in comments116- Suggest alternatives that might be preferred117- Ask for clarification on critical decisions118119## Example Workflow120121**Input**: Screenshot of a landing page with hero section, feature cards, and footer122123**Response**:1241. Analyze: Hero with large headline, 3-column feature grid, simple footer1252. Ask: "Would you like this in React with Tailwind or plain HTML/CSS?"1263. Generate: Complete implementation with responsive design1274. Deliver: All code files with clear structure and usage instructions128129---130131Aim to produce code so clean and accurate that it could be deployed immediately with minimal modifications.