BlogAI

Turning a Figma Frame Into a Prompt That Builds the Right UI

A step-by-step way to hand a design to an AI coding tool: write the spec, name the tokens, list the states, and check the result against your frame.

Denny Pratama

20 Nov 2026 · 6 min read · AI

Turning a Figma Frame Into a Prompt That Builds the Right UI

For years my handoff was a Figma file and a call. A developer read the frames, asked questions, and built the thing. Now I sometimes build my own designs with AI coding tools, and I've had to admit something: the handoff doesn't disappear. I'm just handing off to a different reader.

That reader is fast and eager, and it fills every gap with a guess. A frame that was clear enough for a developer who could message me is not clear enough for a prompt. Here is the process I'd follow to close that gap.

01Step 1: Pick one component, not one screen

Don't paste a whole dashboard and ask for it. The tool will make a hundred small decisions you never see, and you can't review a hundred decisions.

Choose a unit you can check in one sitting. A card, a form, a nav bar, a table row. Build it, check it, then move on. This also gives you a place to start your own design system in code, because each approved piece becomes a reference for the next one.

02Step 2: Write the spec the frame doesn't contain

A frame shows one state at one width. Before you prompt, write down what the frame leaves out. I use this list:

  • Purpose. One sentence on what the component is for and who sees it.
  • Spacing and sizes. The actual values from your file: padding, gaps, radius, widths.
  • Type. Font, size, weight, line height for each text role.
  • Color. Hex values, or better, named tokens (more on that below).
  • States. Default, hover, focus, active, disabled, loading, error, empty.
  • Behavior. What happens on click, on keypress, on failure.
  • Responsive rules. What changes at narrow widths, and what stays.
  • Content limits. What if the title is three words? What if it's thirty?

The last two are where AI output breaks most often. Frames are drawn with tidy sample content, and real content is not tidy. If you've read my piece on layout shift, you know how much of a layout depends on what's in it.

03Step 3: Name your tokens before you prompt

If you paste raw values, you'll get raw values scattered through the code. Ask for variables instead.

Start the prompt with something like this:

Use CSS custom properties for all colors, spacing and type.
Define them once at the top:
--color-text: #1a1a1a;
--color-surface: #ffffff;
--color-accent: #2f5bea;
--space-2: 8px;
--space-4: 16px;
--radius-md: 8px;

These values are placeholders. Use your own. The point is that when you change the accent color later, you change one line. It also makes review easier, because any hardcoded hex in the output is a deviation you can spot at a glance.

If your type scale is deliberate, include it. I wrote about why product UI needs its own type scale, and the same logic applies here: give the tool the scale, or it will invent one.

04Step 4: Put it together in a prompt

Here is a hypothetical example. Say you're handing off a notification card.

Build a notification card in plain HTML and CSS.

Purpose: shows one account alert in a settings page list.

Layout: icon (24px) on the left, title and body text stacked
in the middle, a "Dismiss" text button on the right.
Padding var(--space-4). Gap var(--space-2).

Content limits: the title is one line and truncates with an
ellipsis. The body wraps to a maximum of three lines.

States: default, hover on the card (surface darkens slightly),
visible focus ring on the Dismiss button, and a dismissed
state that removes the card.

Responsive: below 480px, move Dismiss under the body text.

Accessibility: Dismiss must be a real <button> with a clear
accessible name. Don't rely on color alone to show severity.

Use the tokens above. Don't add libraries.

Notice the last line. Stating what you don't want is part of the spec. Without it, tools often pull in extra dependencies you never asked for.

05Step 5: Check the result against the frame

Open the output next to your design and go through it in a fixed order. This is a short version of my fuller review checklist for AI-built UI.

  1. Compare at the frame's width. Overlay or flip between them. Spacing drift shows up fast.
  2. Search the CSS for hardcoded values. Any raw color or pixel number that should be a token is a flag.
  3. Resize the window. Drag it slowly from wide to narrow and watch for overflow, clipped text, and overlapping items.
  4. Stress the content. Replace the title with something very long, then very short. Try an empty body.
  5. Use the keyboard only. Tab through. Can you see where focus is? Does every action work without a mouse?
  6. Check the semantics. Buttons should be buttons, headings should be headings. A clickable div is a common shortcut.

I can do most of these without being an engineer, and that matters. The things I can't judge, like security or performance under load, I shouldn't pretend to judge.

06Step 6: Fix by describing, not by patching

When something is wrong, resist editing the code blindly. Tell the tool what you see and what you expected: "At 400px the Dismiss button overlaps the title. It should wrap below the body text, as in the spec." Specific feedback gets better results than "fix the mobile layout."

If the same problem keeps coming back, the spec is probably missing a rule. Add it to your prompt template so the next component starts with it.

07Keep a reusable template

After a few components, you'll notice you're writing the same sections each time. Save them as a template: tokens block, accessibility rules, the "no extra libraries" line, and your review order. Fill in only the parts that change. This is the closest thing to a design handoff process I've found that works with a tool instead of a person.

One caution I'd repeat: a good prompt reduces guessing, but it doesn't remove the need to check. The output can look right and still be wrong in ways a screenshot won't show.

08Frequently asked questions

Should I paste a screenshot or write a text spec for the AI tool?

Use both. A screenshot shows the layout, but it can't tell the tool about hover states, spacing values, or what happens at a narrow width. The written spec covers the things a picture can't.

How much detail is too much in a handoff prompt?

If a detail changes how the UI looks or behaves, include it. If it only repeats what the tool will do by default, cut it. Build one component at a time so the prompt stays short.

Do I still need a developer if the AI tool builds my design?

It depends on what you ship. For a small marketing site or internal tool, you may manage on your own if you check the output carefully. For anything with payments, user data, or complex logic, I'd want an experienced engineer to review it.

AI

Denny Pratama

Product designer in Indonesia. Since 2018 I’ve designed SaaS products, dashboards and marketing sites, and now I build my own designs too.

About me