Designers hand me Figma files, and I turn them into working interfaces. After dozens of projects translating design to code, I've learned what makes this process smooth versus painful. The difference isn't technical skill – it's understanding the relationship between design tools and code, and building effective communication patterns with your design team.
When I started, I'd open Figma files and feel overwhelmed. Hundreds of layers, nested frames, auto layouts I didn't understand. I'd eyeball measurements, guess at colors, and hope my implementation matched. It didn't. Learning to read Figma properly transformed this frustrating process into something systematic and reliable.
Understanding What You're Looking At
First time opening Figma as a developer, I felt completely lost. The interface is designed for designers, not developers. Layers, frames, auto layout, constraints, components, variants – what does it all mean? Here's the minimum you need to know to be effective.
The Core Concepts
Frames are like divs: They're containers. Everything in Figma lives inside frames. Frames can be nested infinitely, just like HTML elements.
Auto layout frames are like flexbox: They stack items horizontally or vertically with specified spacing. When you see auto layout, think display: flex. The spacing property is literally CSS gap.
Constraints control responsiveness: They determine how elements resize and reposition when their parent changes size. Similar to CSS positioning and sizing properties. "Left and right" constraint means the element should stretch. "Left" with fixed width means it stays left-aligned.
Components are reusable elements: Like React components. A button component can be used throughout the design. Change the master component, and all instances update.
Variants are component states: Default, hover, disabled, active – different states of the same component. This maps perfectly to CSS pseudo-classes and component props.
Understanding these concepts helps you structure your code to match the design system. When you see components with variants in Figma, you know you'll need a component with different states in your code.
The Inspect Panel: Your Best Friend
Don't eyeball measurements and colors. Don't trust your monitor's color accuracy. Use Figma's inspect panel, which gives you exact values for everything.
Select any element, and the right panel shows:
- Dimensions: Width, height, and whether they're fixed or responsive
- Position: X and Y coordinates, plus constraints
- Spacing: Padding inside the element, margins around it, gap between children
- Colors: Fill colors, stroke colors, with exact hex or RGB values
- Typography: Font family, size, weight, line height, letter spacing
- Effects: Shadows, blurs, with all their parameters
- Code: CSS, iOS, Android code (though you'll rarely use it directly)
The copy CSS button gives you actual CSS. It's not production-ready – it often uses unnecessary properties and absolute positioning – but it's a good starting point for complex effects.
My Process for Any New Design
When I receive a new Figma file, I don't immediately start coding. I spend time understanding the design system first. This upfront investment saves hours later.
Step 1: Find the Design System
Check for a design system page or style guide first. Good designers create these. Look for:
- Color palette: Primary, secondary, accent colors, plus grays and semantic colors (success, error, warning)
- Typography scale: Heading styles (H1-H6), body text, captions, with font sizes, weights, and line heights
- Spacing system: 4px, 8px, 16px, 24px, 32px – designers usually use multiples of 4 or 8
- Border radius: Small, medium, large variants
- Shadows: Subtle, medium, pronounced
- Components: Buttons, inputs, cards, all the reusable building blocks
These become CSS variables:
:root {
/* Colors */
--color-primary: #0066cc;
--color-primary-hover: #0052a3;
--color-text: #1a1a1a;
--color-text-secondary: #666666;
--color-background: #ffffff;
--color-border: #e0e0e0;
/* Typography */
--font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
--font-size-base: 16px;
--font-size-h1: 48px;
--font-size-h2: 32px;
--font-size-h3: 24px;
--line-height-base: 1.5;
--line-height-heading: 1.2;
/* Spacing */
--spacing-xs: 4px;
--spacing-sm: 8px;
--spacing-md: 16px;
--spacing-lg: 24px;
--spacing-xl: 32px;
/* Other */
--border-radius-sm: 4px;
--border-radius-md: 8px;
--border-radius-lg: 16px;
--shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
--shadow-md: 0 4px 6px rgba(0,0,0,0.1);
--shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
}
Set these up first. When designers change "primary blue," you update one variable instead of searching through dozens of files.
Step 2: Identify Component Patterns
Before writing any code, identify reusable patterns. Which elements are components? Which are one-offs? How do components vary?
Make a list:
- Button (primary, secondary, ghost variants)
- Input (text, email, password, with error states)
- Card (image card, text card, with optional badges)
- Navigation (desktop, mobile, with dropdown menus)
- Modal (small, medium, large)
This list becomes your component library structure. Build these components once, use them everywhere.
Step 3: Understand Layout Patterns
Look at auto layout settings. They tell you whether something should be flexbox or grid:
- Horizontal auto layout with gap:
display: flex; flex-direction: row; gap: Xpx; - Vertical auto layout with gap:
display: flex; flex-direction: column; gap: Xpx; - Grid of equal items:
display: grid; grid-template-columns: repeat(N, 1fr); - Wrapped horizontal items:
display: flex; flex-wrap: wrap;
Check constraints to understand responsive behavior. "Left and right" constraint means the element should stretch to fill width. "Scale" means it grows proportionally.
Translating Design to Code
Now let's get practical. How do specific Figma features translate to CSS?
Auto Layout → Flexbox
A Figma frame with auto layout set to vertical, 16px spacing, and padding of 24px translates directly:
/* Figma: Auto layout vertical, spacing 16px, padding 24px */
.container {
display: flex;
flex-direction: column;
gap: 16px;
padding: 24px;
}
Horizontal auto layout:
/* Figma: Auto layout horizontal, spacing 12px, padding 16px */
.horizontal-container {
display: flex;
flex-direction: row;
gap: 12px;
padding: 16px;
}
Auto layout with alignment:
/* Figma: Horizontal, centered, space-between */
.nav {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
gap: 1rem;
}
Constraints → CSS Positioning/Sizing
Figma constraints map to CSS sizing:
- "Left and right" constraint:
width: 100%;orflex: 1; - "Left" with fixed width: Element stays left-aligned with fixed width
- "Center" constraint:
margin: 0 auto;orjustify-content: center; - "Scale" constraint:
flex: 1;or percentage width - "Top and bottom" constraint:
height: 100%;
Components → Code Components
Figma component with variants becomes a component with props:
// Figma: Button component with variant=primary|secondary|ghost
function Button({ variant = 'primary', children, ...props }) {
return (
);
}
/* CSS for button variants */
.btn {
padding: var(--spacing-sm) var(--spacing-md);
border-radius: var(--border-radius-sm);
font-weight: 600;
cursor: pointer;
transition: all 200ms;
}
.btn--primary {
background: var(--color-primary);
color: white;
border: none;
}
.btn--primary:hover {
background: var(--color-primary-hover);
}
.btn--secondary {
background: white;
color: var(--color-primary);
border: 2px solid var(--color-primary);
}
.btn--ghost {
background: transparent;
color: var(--color-primary);
border: none;
}
Common Translation Challenges
Real-world design-to-code work always hits these challenges. Here's how I handle them.
Challenge 1: Complex Shadows and Effects
Designers love layering shadows for depth. Figma might show 4 different drop shadows creating one effect. In code, we usually simplify to 1-2 box-shadows that look similar enough:
/* Figma might specify 4 shadows, but this looks close enough */
.card {
box-shadow:
0 1px 3px rgba(0,0,0,0.1),
0 4px 12px rgba(0,0,0,0.08);
}
Perfect replication isn't always worth the complexity. Match the visual intent, not the exact technical implementation.
Challenge 2: Overlapping Elements
Designers layer things freely – an image overlaps a card, text floats over an image. In HTML, we need proper document structure and semantic markup.
Solutions:
- Use absolute positioning sparingly and only when necessary
- Use negative margins for intentional overlaps
- Consider if the overlap is actually necessary or just visual preference
- Talk to your designer about restructuring if it creates accessibility issues
Challenge 3: Fixed Dimensions vs Responsive Design
Designers often work with fixed widths (1440px desktop, 375px mobile). Your code needs to work at every size in between.
Use Figma constraints as hints:
- "Left and right" constraint: Element should be fluid, use percentages or flex
- Fixed width with "left" constraint: Element has max-width, but can shrink on smaller screens
- Centered element: Use
max-widthwithmargin: 0 auto
.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 0 var(--spacing-md);
}
@media (max-width: 768px) {
.container {
padding: 0 var(--spacing-sm);
}
}
Challenge 4: Custom Fonts and Licensing
That beautiful custom font in the design might:
- Not have a web version
- Cost thousands of dollars for web licensing
- Have performance implications (large file size)
- Not support all languages/characters you need
Have fallback strategies:
:root {
--font-family-display: 'CustomFont', 'Georgia', serif;
--font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
Sometimes a system font with proper spacing and sizing looks just as good and loads instantly.
Working Better With Designers
The Figma-to-code process improves dramatically with good communication. This is collaboration, not a one-way handoff.
What I Ask Designers For
- Use components consistently: They map directly to code components
- Name layers meaningfully: "Rectangle 47" helps no one. "Card Background" is meaningful
- Organize with clear hierarchy: Nested frames should match HTML structure
- Share design tokens early: Colors, spacing, typography – we can set these up from day one
- Show edge cases: What happens with long text? Empty states? Loading states? Error states?
- Provide responsive layouts: At minimum, desktop and mobile. Ideally, tablet too
- Document interactions: What happens on hover? What animates? How do transitions work?
What I Give Back to Designers
- Early feedback: Technical constraints and limitations honestly communicated
- Working prototypes: Quick implementations so they see their designs in action
- Explanations for deviations: When I change something and why
- Performance considerations: When designs might cause performance issues
- Accessibility feedback: Color contrast, touch target sizes, screen reader compatibility
Tools That Help
Plugins and tools can speed up the workflow, but understanding beats tools every time.
Useful Figma Plugins
- Design Lint: Catches consistency issues in the design
- Stark: Accessibility checker for color contrast
- Similayer: Finds similar layers to consolidate
- Content Reel: Fills designs with realistic data
Code Generation Tools
- Figma's built-in CSS: Good starting point for complex effects
- Anima: Can generate React components (requires cleanup)
- Locofy: Converts designs to code (still needs human touch)
I use these as inspiration, not production code. Generated code is rarely production-ready. It lacks semantic HTML, accessible markup, and clean structure. But it can show you one way to implement something.
The Interpretation, Not Translation
Here's the most important lesson: design-to-code isn't translation. It's interpretation.
Designers think in visual composition. Developers think in structure and behavior. A Figma file shows one state at one size. Your code must handle all states at all sizes, plus:
- Loading states
- Error states
- Empty states
- Hover and focus states
- Mobile, tablet, desktop, ultrawide
- Light and dark modes
- Different content lengths
- Keyboard navigation
- Screen readers
Treat Figma files as a guide to visual intent, not pixel-perfect specifications. Understand what the design is trying to communicate, then implement it in a way that works in code while maintaining that intent.
The Collaboration Mindset
The best interfaces don't come from designers throwing mockups over a wall to developers. They come from ongoing collaboration:
- Designers understand technical constraints: What's easy, what's hard, what's impossible
- Developers understand design intent: Why this spacing, why these colors, what problem this solves
- Both sides compromise: Sometimes design adjusts for technical reality. Sometimes code finds creative solutions for design vision
- Communication is continuous: Questions, feedback, iterations happen throughout, not just at handoff
Work with your designers as partners. Ask questions. Explain technical limitations honestly. Suggest alternatives when something is particularly difficult. Show them prototypes early so they can give feedback before you've built everything.
The goal isn't perfect Figma-to-code conversion. The goal is building great user interfaces that work well, look good, and are maintainable. Sometimes that means deviating from the design. That's okay if you communicate why.