The Art of Prototyping: When to Code, When to Design

AJ
15 min read

Figma or Code? The Eternal Question

You've got a new feature to explore. You open your laptop, stare at the screen, and face the same question every design engineer asks: do I open Figma or my code editor? It seems like a trivial decision, but picking the wrong tool can waste days. I've spent hours building coded prototypes for stuff that should've been three Figma screens. I've also spent hours in Figma faking complex interactions that would've taken 20 minutes to build for real in React.

The trick isn't about which tool is better. It's about which tool answers your specific question fastest. Once you internalize this framework, you'll stop wasting time on the wrong approach and start shipping prototypes that actually teach you something useful. This guide walks you through exactly how to make that decision for every feature, every time.

┌──────────────────────────────────────────────────────────────┐
│                  Prototyping Decision Tree                    │
├──────────────────────────────────────────────────────────────┤
│                                                              │
│  What are you testing?                                       │
│       │                                                      │
│       ├── Layout & visual design?                            │
│       │       └── ✅ Figma (faster for static exploration)   │
│       │                                                      │
│       ├── User flow & navigation?                            │
│       │       └── ✅ Figma (click-through prototypes)        │
│       │                                                      │
│       ├── Complex interaction or animation?                   │
│       │       └── ✅ Code (Figma can't fake this well)       │
│       │                                                      │
│       ├── Real data & edge cases?                            │
│       │       └── ✅ Code (needs real API / data volume)     │
│       │                                                      │
│       └── Performance or accessibility?                      │
│               └── ✅ Code (only real browsers can test this) │
│                                                              │
│  Rule of thumb: If Figma can answer it, use Figma.           │
│  It's always faster for static exploration.                  │
└──────────────────────────────────────────────────────────────┘

Understanding the Fidelity Spectrum

Before diving into when to use which tool, let's talk about fidelity. Prototyping isn't binary. It's a spectrum from rough sketches to production code, and each level serves a different purpose. The mistake most frontend developers make is jumping straight to high fidelity when low fidelity would answer their question in a fraction of the time.

  • Whiteboard / Paper: 5 minutes. Just scribble the flow and talk about it. Great for brainstorming and alignment.
  • Figma wireframes: 30 minutes. Gray boxes and basic layout. Test structure and navigation ideas without getting distracted by visual design.
  • Figma high-fidelity: A few hours. Real colors, real typography, realistic content. Good for showing stakeholders and getting sign-off.
  • Coded prototype: Half a day. Real interactions, real data, real behavior. Needed when Figma can't answer your question.
  • Production code: Days to weeks. The real thing with all the edge cases, error handling, accessibility, and tests.

Match Fidelity to Uncertainty

Here's a principle that took me years to learn: the more uncertain you are about a feature, the lower the fidelity should be. If you don't even know what the feature should do yet, a whiteboard sketch is perfect. If you know the general direction but need to validate the layout, Figma wireframes are ideal. If the layout is settled but you're unsure about an interaction, code a quick prototype. Always start low and increase fidelity as certainty grows.

When Figma Is the Better Choice

Figma is your best friend when speed matters most and when non-technical people need to see and understand the work. It's faster than code for anything visual and static. Here are the specific situations where Figma wins every time.

Exploring Multiple Options Quickly

You can make five different layout ideas in Figma in the time it takes to code one. Duplicate a frame, try a different arrangement, see how it feels. There's no compile step, no state management, no routing. Just pure visual exploration. This is incredibly valuable in the early stages of frontend development when you're still figuring out the right approach.

Communicating with Stakeholders

Non-technical people understand Figma prototypes instantly. They can click through flows, leave comments, and give feedback without running a dev server. If your goal is getting approval or buy-in from product managers, executives, or clients, Figma is the obvious choice. Nobody wants to clone a repo and run npm install just to see a feature concept.

Visual Design Decisions

Colors, fonts, spacing, layout composition. These are all faster to iterate on in Figma than in code. You can adjust a font size with a slider instead of changing a Tailwind CSS class, rebuilding, and checking the browser. For pure visual polish, Figma wins hands down.

User Flow Testing

Figma's prototyping mode lets you create click-through flows that feel surprisingly real. You can run usability tests with users using just Figma prototypes, which is much faster than building the whole flow in React. If you're testing navigation patterns or multi-step processes, Figma prototypes are perfectly adequate.

When Code Is the Better Choice

Code wins when you need to test things Figma simply cannot fake. No matter how good your Figma skills are, there are certain questions that only a real browser with real code can answer. Here's when you should skip Figma entirely and go straight to your code editor.

Real Data at Scale

How does the UI look with 3 items? 300? 3,000? What about items with names that are 5 characters long versus 200 characters? Figma can show you one state at a time, but code lets you test the full range of data variations. If data volume or content length affects your UI design, you need to prototype in code.

Complex Interactions and Animations

Drag and drop, gesture-based interfaces, real-time collaborative features, physics-based animations, complex form validation with dynamic rules. These interactions are either impossible or painfully awkward to fake in Figma. A 30-minute coded prototype with React and a library like Framer Motion will tell you more than a day spent trying to fake it in Figma's prototyping mode.

Performance Validation

Will this animation run at 60fps? Can the browser handle rendering 1,000 list items with virtual scrolling? Does this layout cause expensive reflows? Figma can't answer any of these questions. Performance testing requires real code running in a real browser.

Accessibility Testing

Screen readers can't parse a Figma prototype. Keyboard navigation doesn't work in Figma. If you need to validate that a component is accessible, you need to build it in code and test it with real assistive technology. This is especially important for complex UI components like modals, dropdown menus, and tabbed interfaces.

Quick React Prototyping Setup

When I decide to prototype in code, speed matters more than anything. I'm not writing production code. I'm writing throwaway code to learn something. Here's my exact setup that gets me from zero to building in about two minutes.

setup.bash

Prototype Code Example: Kanban Board

Here's a real example. We needed to test whether drag-and-drop kanban boards would feel natural for our task management feature. Figma couldn't answer this. So I coded a quick prototype using the HTML drag and drop API.

Prototype.tsx

Rules for Prototype Code

Prototype code has different rules than production code. Understanding this difference is key to moving fast. Here's how I approach it:

  • No tests. You're going to throw this away. Tests would be wasted effort.
  • Inline everything. No abstractions, no shared utilities, no clever patterns. Keep it all in one file.
  • Hardcode data. Don't build an API for a prototype. Use a const array at the top of the file.
  • Skip error handling. Happy path only. If it crashes on edge cases, that's fine for now.
  • Use component libraries. shadcn/ui gives you polished components instantly. Don't build from scratch.

The Decision Framework

Not sure which tool to pick? Ask yourself these five questions. They'll give you the answer every time. I've used this framework on dozens of projects and it hasn't steered me wrong yet.

  1. What are you testing? Layout and visual design → Figma. Interaction and behavior → Code.
  2. Who needs to see it? Stakeholders and non-technical people → Figma. Engineers and technical team → Code.
  3. How complex is the interaction? Click-through flows → Figma. Drag/scroll/real-time/gesture → Code.
  4. Does data volume matter? If 10 items vs 10,000 items changes the design → Code. Fixed content → Figma.
  5. How fast do you need it? Under an hour → Figma almost always. Can invest half a day → Code if the question requires it.
┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│   Day 1-2        │     │   Day 3-4        │     │   Day 5+         │
│   EXPLORE        │     │   VALIDATE       │     │   BUILD          │
│                 │     │                 │     │                 │
│  Figma wireframe │────▶│  Figma hi-fi +   │────▶│  Production code │
│  3-5 directions  │     │  Code prototype  │     │  with confidence │
│  Quick & broad   │     │  of tricky parts │     │  about the UX    │
└─────────────────┘     └─────────────────┘     └─────────────────┘
       │                        │                        │
       ▼                        ▼                        ▼
  "Which direction      "Does this actually     "Build it right
   should we go?"        work in practice?"      for production"

The Best Approach: Use Both Strategically

Honestly, the best approach for any significant feature uses both tools. The key is using each one where it shines. Here's the workflow I follow on most projects, and it consistently catches problems early when they're cheap to fix instead of halfway through production development.

The Ideal Prototyping Workflow

  • Day 1: Explore 3-5 directions in Figma wireframes. Quick, broad, low fidelity. Get feedback from the team on direction.
  • Day 2: Pick the best direction. Flesh it out in Figma with real content, proper typography, and realistic data.
  • Day 3: Code the tricky interactions that Figma can't represent. Test with real data volumes and edge cases.
  • Day 4: Combine what you learned from both. Update the Figma design based on code learnings. Update the prototype based on design refinements.
  • Day 5: Start building for real with confidence. You know the layout works (Figma told you), the interactions work (code told you), and stakeholders are aligned (Figma presentations told you).

Why This Workflow Saves Time Overall

This might seem slow. Five days before writing production code? But here's what actually happens without prototyping: you spend two weeks building a feature, ship it, get feedback that the interaction feels wrong, and spend another week rebuilding it. Three weeks total. With prototyping, you spend one week exploring and validating, then one week building with confidence. Two weeks total and a better result.

Figma-to-Code Handoff Tips

Whether you're handing off to yourself or to other developers, there are some practices that make the transition from Figma prototype to React code much smoother.

Name Your Figma Layers Like Components

If you name your Figma frames and components the same way you'd name your React components, the mental translation is instant. A frame called "TaskCard" maps directly to a<TaskCard /> component. A frame called "Sidebar/NavItem" maps to your component structure. This tiny habit saves significant time during implementation.

Use Figma Auto Layout for Everything

Auto Layout in Figma maps directly to CSS Flexbox, which maps to Tailwind CSS utility classes. If your Figma design uses Auto Layout everywhere, translating it toflex flex-col gap-4 in Tailwind is nearly mechanical. Fixed positioning in Figma, on the other hand, tells you nothing about how the layout should actually behave in code.

Document the Edge Cases

Your Figma prototype shows the happy path. But what happens when the list is empty? When there's an error? When content is loading? When the user's name is 50 characters long? Add Figma frames for these states. They're quick to create in Figma and they prevent developers from having to guess during implementation. This is where design systems really shine in frontend development.

Tools for Faster Prototyping

  • Figma + FigJam: FigJam for the initial brainstorm, Figma for the refined prototype. Use them together.
  • Next.js + shadcn/ui: The fastest way to get a coded prototype running. Pre-built React components with Tailwind CSS styling.
  • v0.dev: Vercel's AI tool can generate UI components from descriptions. Great for quick starting points.
  • Storybook: Build and test individual components in isolation before assembling the full prototype.
  • CodeSandbox / StackBlitz: Browser-based IDEs for quick prototypes you can share via URL. No setup required.

The Prototyping Mindset

The most important thing about prototyping isn't which tool you use. It's your mindset. A prototype exists to answer a question. Before you start, write down the question you're trying to answer. "Will users understand this navigation pattern?" "Can we render 10,000 rows without lag?" "Does this color palette work in dark mode?" If you can't articulate the question, you're not prototyping. You're just building stuff and hoping for the best.

Prototypes Are Meant to Be Thrown Away

This is the hardest lesson for developers to internalize. That beautiful coded prototype you spent half a day on? Delete it. Don't refactor it into production code. Production code has different requirements: error handling, accessibility, testing, performance optimization, edge cases. Trying to evolve a prototype into production code creates technical debt from day one. Build the prototype, learn from it, then build the real thing from scratch with all the knowledge you gained.

The Complete Prototyping Checklist

  • Write down the question your prototype needs to answer before you start
  • Start at the lowest fidelity that can answer your question
  • Figma for exploring ideas, layouts, and talking to non-technical stakeholders
  • Code for real interactions, real data, performance, and accessibility
  • Use Next.js + shadcn/ui + Tailwind CSS for the fastest coded prototypes
  • Match fidelity to uncertainty. More uncertainty = lower fidelity.
  • The best workflow uses both: Figma first for exploration, then code for validation
  • Name Figma layers like React components for seamless handoff
  • Document edge cases in Figma: empty states, errors, loading, long content
  • Prototypes are disposable. Never refactor a prototype into production code.
  • Spending a week prototyping saves two weeks of building the wrong thing

Prototyping isn't a luxury. It's an investment. Every hour spent prototyping saves multiple hours of building, rebuilding, and arguing about what should have been built in the first place. Whether you reach for Figma or your code editor, the important thing is that you're exploring before committing. That's what separates good design engineering from just writing code and hoping it works.

Related Articles

Your Product
Deserves a better ui