Figma to working forms

The designer sends over a Figma link. You spend the next two days measuring paddings with a ruler tool and guessing which gray is #8E8E93 and which is #8A8A8E. Then the designer moves a button, and you do it again.

That job is mechanical, and mechanical jobs belong to the computer. Design Import reads the design and writes the form.

Download the Design Import tour.

What goes in, what comes out

In: a Figma link (through Figma’s API with your personal access token) or a .fig file, a Sketch file, a Photoshop PSD, an SVG, or a React or HTML prototype, the kind every AI design tool spits out now.

Out, three things:

  • a Form split into a generated base class and a subclass that’s yours to edit,
  • a stylesheet with one UIID for each distinct style in the design,
  • a unit test that checks every component is there with its UIID and text, that wide components stretch, and that the vertical order matches the design.

Run it from the root of your app:

mvn cn1:import-design        # or: ./gradlew importDesign

That opens a four step wizard: Design, Screens, Review, and Write. For CI or a script, skip the window:

mvn cn1:import-design -Dcn1.design=designs/login.fig -Dcn1.design.class=LoginForm

A second import rewrites the base class and the stylesheet and never touches your subclass. So the designer can move that button again, and your event handlers survive.

It reads shapes, not layer names

Designers don’t name layers. Real files are full of Rectangle 9 and Group 47. The importer looks at what a layer is: a filled box with one centered line of text is a button, whatever it’s called. A tall box with a gray line at its top left is a multi-line text field. A layer that dims the screen and holds a smaller panel is a popup, and a panel docked to the bottom edge becomes a bottom sheet. A screen drawn taller than a phone becomes a scrolling form with the title bar pinned at the top.

flowchart LR D[Figma / Sketch / PSD
SVG / HTML] --> S[Scope
pick the screen] S --> C[Detect and classify
button? field? label?] C --> L[Structure and layout
rows, columns, auto layout] L --> P[Popups and
long screens] P --> R[Responsive
stretch, cap, breakpoints] R --> Y[Style
UIIDs and CSS] Y --> E[Emit
form, stylesheet, test]

Draw a phone frame and a tablet frame with the same name, Login / Phone and Login / Tablet, and you get one adaptive form that switches layouts at a width breakpoint. Draw just one, and the form still adapts: wide components stretch, and on a big screen the content is capped and centered instead of a login field stretched across a 27-inch monitor.

The same grid of buttons as a running Codename One form

It tells you where it guessed

Every import tool guesses. Most hide it. This one keeps a list. Every guess, and every effect CSS can’t express (a blend mode, an inner shadow), is an issue with a severity, the stage that raised it, the layer it belongs to and a suggested fix. In the workbench, clicking an issue selects its layer in the design and in the live form side by side.

The workbench: layers, the design and the live form side by side, and the issue list

My favorite issue is flattened. Hand it a screenshot or a PSD with every layer merged, and the result would be an image of a UI that matches the design perfectly and does nothing. The tool says so instead of reporting a great score.

Or let your agent do it

Everything the workbench does is also an MCP tool: open a design, list its screens, run the stages, read the tree and the issues, override a layer’s role or layout, render a preview at any width, score it against the design, and write the sources. You don’t wire any of that up yourself. The Codename One agent skill that every Initializr project ships with tells your coding agent the tool exists and how to use it, so you ask for the screen and the agent runs the import.

Note what the agent is and isn’t doing. Design Import itself is not a language model. It’s a deterministic pipeline: the same design gives the same form every time, and every guess it makes is written down as an issue. The agent decides what to do about those issues, but it never makes up the layout, the colors or the spacing. Those come from the design file.

So the loop becomes: you paste the Figma link into your agent, it imports, renders the preview next to the design, sees that “Forgot password?” came in as a label instead of a link, sets the role, scores again, and writes the form. You review the diff, not the pixels.

How good is it?

We measured it the only fair way, on designs where we know the answer. The tests take the twelve GUI Builder demo forms, export each to SVG with every layer renamed to the meaningless names design tools use, and import them back. 71 of 74 components come back as the right kind of component. The five Sketch files from the developer guide’s GUI Builder chapter are imported too, and never used to tune the rules.

The layout is usually right. Spacing is close. Multi-line text and unusual controls often need a role override or an edit in your subclass. It’s a starting point that saves the boring two days, not a promise that you’ll never open the form again.

Read Design Import in the developer guide and try it on the design you’re putting off. Tomorrow: reviewing agent code visually.