Single logo
  • Courses
  • Blog
  • About
Join on SkoolJoin on Skool

In this topic

React
  • One Request, Two Answers: the Same Post as an HTML Page and as JSON
  • A Blog Design from a Prompt: Downloading Figma Make Code and Reading App.tsx and BlogCard.tsx
  • How a Web Page Works: HTML Tags, Elements and Attributes
  • Semantic HTML: header, nav, main, aside and footer as Page Landmarks
  • HTML Forms: Labels, Names, Input Types and Where the Data Goes (GET vs POST)
  • CSS Basics: Selectors, Which Rule Wins, and the Box Model
  • CSS Flexbox vs Grid: A Nav Bar, a Card Row and a Dashboard
  • Responsive CSS: Viewport, Mobile-First Media Queries, clamp() and Dark Mode with Tokens
  • JavaScript for People Who Already Code: Syntax, Modules and Five Surprises
  • JavaScript Arrays the Functional Way: map, filter, reduce, find, sort and Object.entries
  • Async JavaScript: Promises, async/await, fetch and Promise.all
  • JavaScript in the Page: the DOM, querySelector and Events
  • npm, package.json and Vite: What npm install Fetches and How Vite Serves and Builds Your Page
  • TypeScript Essentials: Types Checked, Then Erased (Interfaces, Unions, Generics)
  • Why React, JSX and Components: The Page as a Function of Data
  • React Props and Composition: Data Down, Calls Up, Children in the Slot
  • Routing With React Router: One Page, Many Addresses
  • React Component Tests With Vitest and Testing Library: Test What the User Sees
  • End-to-End Tests for a React App With Playwright: A Full Dress Rehearsal
  • Why AI-Built Websites All Look the Same, and Four Levels That Fix It
  • Visual Hierarchy, Spacing and the 8-Point Grid: Tell the Eye What to Read First
  • Colour, Contrast and Dark Palettes: 60-30-10, Semantic Tokens and Ratios You Can Compute
  • Typography That Sells: Type Scale, Line Length and Free Font Pairings
  • The UI Element Catalogue: Buttons to Toasts, Their Jobs, States and shadcn/ui Names
  • Design Tokens: Primitive and Semantic Tokens, from Figma to CSS to Tailwind
  • Tailwind CSS 4 in React: Utility Classes, Responsive Prefixes, Hover and Dark Mode
  • shadcn/ui in React: Components You Own, Edit and Commit
  • Design Tokens to a Tailwind Theme: Light and Dark Mode with @theme inline
  • Motion in React: Entrance, Hover, Exit and Layout Animations
  • A React Dashboard: Stat Cards, a Recharts Line Chart and a Sortable Table
  • Accessibility in Practice: Dialogs, Menus and the Keyboard in React
  • Reference-Driven Design: Extract a DESIGN.md From a Site You Admire and Build From It
  • Components, Variants and Variables: One Design System in Figma and in CSS
  • Figma MCP Server: Build a React Component From a Frame, Then Write It Back
  • Claude Design: From a Brief to a Clickable Prototype, Then Hand It Off to Claude Code
  • Critiquing AI-Generated UI: Six Checks for Every Screen
  • The AI Design Landscape: Prompt to UI, Prompt to App, and Design to Code
  • Your Brand Rules Folder: One Folder Every AI-Built Page Follows
  • The Best-Practice UI Prompt: Plain Sentences That Beat the Average AI Page
  • UI Ideas From Figma Make, Google Stitch and ChatGPT: One Prompt, Three Designs
  • Google Stitch From a Sketch or Screenshot: Show the Layout, Say What to Keep
  • Stitch to Figma to Code: Turn a Stitch Screen Into Code That Uses Your Tokens
  • Figma Make: Prompt to Prototype With a Four-Part Prompt
  • Upgrade a Dated UI From One Screenshot (or a Reference Image)
  • States and Feedback: Make Every Click Get an Answer
  • A Design-Loop Skill: Claude Screenshots, Scores and Fixes Its Own UI
  • Copy Without the AI Tells: A Copy Pass on a Landing Page
  • React State, Events, Lists and Conditional Rendering: Follow One Click
  • React useEffect: When It Runs, What Cleanup Is For, and When You Don't Need One
  • Lifting State Up, Refs and React DevTools: Put State Where It Is Needed
  • Forms and Actions in React 19: Controlled Inputs, Form Actions, useActionState and useFormStatus
  • React Context and Custom Hooks: Share One Value, Reuse the Logic
  • Server State With TanStack Query: One Key, One Request, One Cache
  • Mutations and Optimistic Updates in TanStack Query: Change Data, Then Tell the Cache
  • Generate TypeScript Types, Query Hooks and Zod From an OpenAPI Spec With Orval
  • A Mock Backend in the Browser With Mock Service Worker, Generated From the Spec
  • A React Client for a FastAPI API: The CORS Wall, CORSMiddleware and the Vite Proxy
  • Forms With React Hook Form and Zod: The API's Rules in the Browser, the Server's Errors Under the Field
  • JWT Auth in a React Client With a FastAPI Backend: Log In, Carry the Token, Let the Server Decide
  1. Blog
  2. /
  3. React
  4. /
  5. Fundamentals

Stitch to Figma to Code: Turn a Stitch Screen Into Code That Uses Your Tokens

A Stitch export is full of hard-coded values like bg-[#F8FAFC] and rounded-[10px]. Map them to your own tokens (bg-surface, rounded-card, bg-brand) through Figma variables, a Tailwind @theme inline block, or the Stitch MCP server, then fix states, accessibility and data by hand.

Chaand Sheikh

·27 November 2026·Updated 28 November 2026Fundamentals

What you will learn

  • Name the three roads from a Stitch screen to code: via Figma, via HTML and Tailwind, via the Stitch MCP server
  • Swap hard-coded fills in Figma for your own variables
  • Rewrite exported Tailwind arbitrary values like bg-[#4F46E5] as token classes with an @theme inline block
  • List what you still fix by hand after any export: states, accessibility and real data

Before you start

  • Google Stitch From a Sketch or Screenshot
  • Basic Tailwind CSS classes

Google Stitch gives you a nice-looking screen fast. The question is how to get it into your project without dragging a pile of raw hex colours along with it. The answer in every case is the same: turn the screen into code that uses your own tokens. A token is just a named value, like the brand colour.

The example is a sprint card for Orbit, a sample team project app.

Draft, polish, build

The journey has three stops. You draft the screen fast in Stitch. You can polish it in Figma and connect it to your variables. And you end with code: React with Tailwind CSS 4. You don't always need the middle stop, so there are three roads:

Three roads from Stitch to code Stitch draft fast Code React + Tailwind 4 1. Figma swap fills for variables 2. HTML + Tailwind export map classes to tokens 3. Stitch MCP agent reads the screen
Three roads, one destination: code that says bg-brand, not bg-[#4F46E5].

The screen used in the lesson came from a Stitch prompt like this one:

Design a sprint card for Orbit, a team project-management app. It shows the sprint name, how many tasks are left, and an "Open board" button. Clean, light theme, indigo accent.

Road 1: through Figma, swap hard-coded colours for variables

Stitch can send a screen to Figma. Once it's there, select the button: its fill is a plain colour, a hard-coded value. Your job is to swap each one for your own variable. The hard-coded indigo becomes color/brand, the light grey becomes color/surface, and the dark blue becomes color/ink. Figma's panels change often, so look for the fill and the variable picker rather than an exact menu name.

You can ask an AI assistant in Figma to do the swap for you:

Take the selected frame and replace every hard-coded fill and corner radius with the matching variable from our Orbit variables: color/brand, color/surface, color/ink, color/muted and radius/card. List anything that has no match.

Why bother? Because now a brand change is one edit, not fifty. Variables in Figma are covered in more depth in Components, Variants and Variables.

Road 2: HTML and Tailwind, map the classes to our theme

Stitch can also export a screen as HTML with Tailwind classes. This is the sprint card as exported, from the project's before/index.html:

<!-- Exported as-is: every colour and radius is hard-coded -->
<div class="bg-[#F8FAFC] rounded-[10px] p-4 max-w-sm">
  <h3 class="text-[#0F172A] font-semibold">Sprint 12</h3>
  <p class="text-[#475569] text-sm">8 tasks left, 3 due this week</p>
  <button class="bg-[#4F46E5] text-white rounded-[10px] px-4 py-2 mt-3">
    Open board
  </button>
</div>

Every colour and every size is an arbitrary value in square brackets. Map them to names:

ExportedToken class
bg-[#F8FAFC]bg-surface
rounded-[10px]rounded-card
text-[#0F172A]text-ink
text-[#475569]text-muted
bg-[#4F46E5]bg-brand

The same card, from after/index.html:

<!-- Same card, now written with our tokens -->
<div class="bg-surface rounded-card p-4 max-w-sm">
  <h3 class="text-ink font-semibold">Sprint 12</h3>
  <p class="text-muted text-sm">8 tasks left, 3 due this week</p>
  <button class="bg-brand text-white rounded-card px-4 py-2 mt-3">
    Open board
  </button>
</div>

Where do these names come from? From after/tokens.css. First, plain CSS variables in :root. Then an @theme inline block, which tells Tailwind 4 about them, so bg-brand reads the --brand variable:

@import "tailwindcss";

/* Orbit design tokens: the one place the values live */
:root {
  --brand: #4F46E5;
  --surface: #F8FAFC;
  --ink: #0F172A;
  --muted: #475569;
  --card-radius: 10px;
}

/* Tell Tailwind about them, so bg-brand, text-ink and rounded-card exist */
@theme inline {
  --color-brand: var(--brand);
  --color-surface: var(--surface);
  --color-ink: var(--ink);
  --color-muted: var(--muted);
  --radius-card: var(--card-radius);
}

The look is the same. The values now live in one place. The prompt for this mapping:

Here is HTML exported from Stitch (see before/index.html). Rewrite it for Tailwind CSS 4 using our tokens only: bg-brand, bg-surface, text-ink, text-muted, rounded-card. Do not keep any arbitrary values like bg-[#4F46E5]. Also give me the @theme inline block that defines the tokens from CSS variables.

Road 3: the Stitch MCP server pulls the screen for you

The fastest road is the Stitch MCP server. MCP is a plug that lets one tool talk to another. You tell your AI coding tool to build the Orbit dashboard from your Stitch screen with your tokens:

Using the Stitch MCP server, read my Orbit dashboard screen and build Dashboard.tsx in React 19 with Tailwind CSS 4. Use our tokens, not the raw colours. Then list what I still need to add: hover and focus states, empty and error states, accessibility labels, and real data.

The agent reads the screen from Stitch by itself (a header, three stat cards and a task list) and writes the file using bg-surface, text-ink and bg-brand. No export, no copy and paste. The exact wording you see depends on your tool. The same idea with Figma is shown in Figma MCP Server: Design to Code and Back.

What you still fix by hand

Whichever road you take, the export is a first draft. Three things always need you:

  • States. The design shows one look, but a button also needs hover and focus, and a list needs an empty state and an error state. See States and Feedback.
  • Accessibility. Check colour contrast, labels, and whether you can use it with a keyboard.
  • Real data. The export has sample text, like names and numbers. Your app needs data from your own code.

A review prompt that covers them:

Check Dashboard.tsx for colour contrast, keyboard access, missing labels and hard-coded sample text. List the fixes, most important first.

Quick recap

RoadWhat you doResult
Via FigmaSwap hard-coded fills for variablesA design bound to color/brand, color/surface, color/ink
HTML + TailwindMap arbitrary values to token classes, add @theme inlinebg-surface, rounded-card, bg-brand
Stitch MCPLet the agent read the screenA component written with your tokens

The design is a draft. The tokens are yours.

Try it yourself

Open before/index.html and find every hard-coded value. Rewrite the card with the tokens, compare it with after/index.html, then change --brand once and watch the whole card follow.

Tried the exercise? Share your answer or ask a question.

The StudyEasy AI Community is free to join, with the lesson files, notebooks and code.

Join free on Skool

Keep going in React · 42 of 59

Previous
Google Stitch From a Sketch or Screenshot: Show the Layout, Say What to Keep
Next post
Figma Make: Prompt to Prototype With a Four-Part Prompt

Related course on Udemy

The Python Architect Masterclass: Full Stack to AI Engineer

Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)

Related posts

One Request, Two Answers: the Same Post as an HTML Page and as JSON

Ask a Django blog for the same post twice: once as a 12,731-byte HTML page built by a template, once as 2,976 bytes of JSON built by a serializer. Compare the headers, see who builds the page, and why the server still owns every write.

A Blog Design from a Prompt: Downloading Figma Make Code and Reading App.tsx and BlogCard.tsx

Make a blog design from a prompt in Figma Make, download src.zip, unzip it with Python's zipfile module, and read the two files that matter: App.tsx with its selectedPost state and BlogCard.tsx with its props.

How a Web Page Works: HTML Tags, Elements and Attributes

A web page is a text file full of labelled pieces. Learn tags, attributes and nesting with three tiny pages, and see what breaks when an attribute or a closing tag is wrong.

Semantic HTML: header, nav, main, aside and footer as Page Landmarks

The same page written as div soup and with semantic tags looks identical, but only one gives screen readers and search engines landmarks and an outline. Plus tables, div, span and the one-main rule.

On this page

  • Draft, polish, build
  • Road 1: through Figma, swap hard-coded colours for variables
  • Road 2: HTML and Tailwind, map the classes to our theme
  • Road 3: the Stitch MCP server pulls the screen for you
  • What you still fix by hand
  • Quick recap
  • Try it yourself
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

Related course on Udemy

The Python Architect Masterclass: Full Stack to AI Engineer

Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)

Single logo

Empowering Education, One Course at a Time

About
About usContact us
Legal
Terms of UsePrivacy Policy

© 2026 StudyEasy Organization. All rights reserved.