The Mental Model
The Visual Sampler.
In music, producers sample old records to get a vibe. In coding, we sample Images.
Vision is the new API. Modern AI can "see" layouts, spacing, and hierarchy.
Images are unambiguous. "Make it look like this" beats 500 words of description.
Speed is the goal. From concept to code in seconds, not hours.
// The Old Way
Look at design → Guess padding → Type div → Check browser → Repeat.
// The Synth Way
Upload Image → "Build this in Tailwind" → Copy Code.
<div className="h-4 w-12 bg-gray-200"/>
...
</div>
The Input Types
Not all inputs are equal. The quality and type of your visual artifact directly impacts output quality.
- BestClean screenshot of existing UI. AI knows exactly what to build.
- GoodWireframe/mockup. Clear structure, leaves room for interpretation.
- OkayHand-drawn sketch. Works if boxes and hierarchy are clear.
- AvoidText-only description. Ambiguous, leads to guessing.
Pro tip: Combine a screenshot with "but change the colors to..." for best results.
Quality Spectrum
Screenshot — 95% accuracy
Wireframe — 80% accuracy
Sketch — 60% accuracy
card with
shadow"
Text only — 40% accuracy
The Napkin Sketch
Hand-drawn → Code
AI vision is surprisingly good at reading handwriting and rough shapes. Draw boxes, label them, and the AI will interpret structure.
The Screenshot
Existing UI → Your Code
Screenshot existing UI you admire. The AI reverse-engineers the layout, spacing, and structure. Ethical note: Use for learning structure, not copying brand identity.
The Constraint Prompt
If you just upload an image with no instructions, the AI will guess your tech stack. You must constrain the output to match your project.
Tech Stack
Specify React, Vue, vanilla HTML. Specify Tailwind vs CSS.
Styling Rules
No custom CSS? Dark mode? Specific color palette?
Icon Library
Lucide, Heroicons, or SVG? Be specific or get random.
Responsive
Mobile-first? Tablet breakpoints? State this upfront.
Complete Example Prompt
"Recreate this UI I've attached.
Requirements:
1. Use React with TypeScript
2. Use Tailwind CSS utilities only (no custom CSS)
3. Use Lucide React for any icons
4. Make it responsive (mobile-first)
5. Match the spacing and proportions closely"
The Tool Stack
v0.dev
By Vercel
Best for pure UI generation. It renders the code live so you can see it and iterate in real-time.
Claude Sonnet
By Anthropic
The smartest logic. Upload a screenshot and ask it to not just build the UI, but wire up click handlers too.
ChatGPT-4o
By OpenAI
Excellent vision capabilities. Good all-rounder that can handle both UI and logic with strong reasoning.
Common Pitfalls
✗ What Goes Wrong
Wrong Tech Stack
AI defaults to vanilla HTML/CSS if you don't specify React/Vue/etc.
Inline Styles
Without "Tailwind only", you might get style={} everywhere.
Wrong Proportions
AI may guess sizing. Add "match the proportions exactly" to your prompt.
Missing Responsiveness
Desktop-only output is default. Always specify mobile-first.
✓ The Fix
Be Explicit
"Use React with TypeScript and Tailwind CSS" — leave no ambiguity.
Add Constraints
"No inline styles. No custom CSS files. Tailwind utilities only."
Reference Real Values
"The card should be 400px wide with p-6 padding" — be specific.
Iterate Fast
"Make the button smaller" or "Increase the gap to gap-6" — quick fixes.
The Exercises
From vision to code in under 60 seconds.
The Napkin Test
Hand-Drawn → Code
- →Draw a "Login Card" on paper
- →Snap a photo with your phone
- →Upload to v0 or Claude
- →Prompt: "Build this in React + Tailwind"
The Remix
Screenshot → Modified
- →Screenshot a component you admire
- →Upload with a twist request
- →"Use this layout but make it dark mode"
- →Paste the code into your project
The Full Prompt
Constrained Generation
- →Pick any website hero section
- →Write a full constraint prompt
- →Include: stack, styling, icons, responsive
- →Compare output with/without constraints
📋 Quick Reference Cheatsheet
Basic Prompt
"Recreate this UI in React + Tailwind"With Constraints
"...no custom CSS, Lucide icons, mobile-first"Iteration
"Make the gap larger" "Use rounded-xl"