~/wiki / figma-i-makety / code-to-canvas-figma-workflow

Code-to-Canvas: Developer generates code – it enters Figma as editable layers

Main chat

A chat for vibe coders: news, guides, live cases, marketplace, and finding executors.

$ cd section/ $ join vibe dev
Code-to-Canvas: Developer generates code – it enters Figma as editable layers - обложка

Usually we are used to one direction of flow: the designer draws in Figma, the developer translates the layout into code. Code-to-Canvas turns the arrow around. Code—generated by a human, an AI agent, or pulled from live production—is turned back into editable layers of Figma. Not a picture. No preview. It is the layers with autolayaut, components, variables.

It sounds like a trick, but in practice it's a major shift in the workflow. Design ceases to be the source of truth that slowly diverges from the real product. And at the same time, a new class of risks appears: what counts as a canon, who owns the component, how not to drown in the duplicate layers generated overnight.

Why did it even become possible

Several things came together at the same time. First, the frontend has become predictably declarative: React, Vue, SwiftUI, Compose describe the UI as a tree very similar to the Figma layer tree. Secondly, Figma has something that was previously lacking for two-way work – autolayout as a full-fledged analogue of flex, variables as an analogue of tokens, code connect and MCP integration. Third, code generation by AI agents has become routine: a developer receives dozens of screens per day that need to be reviewed and coordinated somewhere.

When the flow of code grew by an order of magnitude, the bottleneck was not the code, but its design revision.

What does "edited layers" mean, not a picture

This is the watershed on which the whole approach stands. If the code is imported as png or embed, it is simply documentation. Useful, but not different from Storybook with screenshots.

The editable layers are:

  • Autolayout frames where padding and gap correspond to real CSS values n
  • Text layers with real content and applied text styles
  • Design system instances used, not rectangles drawn from scratch
  • Colors and sizes tied to variables, not hard-cut
  • Hierarchy Repeating Component Structure in Code

It is only in this form that you can work with the layout: move, rearrange, offer an alternative, morgue with the existing library.

Anti-import patterns

  • Each div turns into a separate frame without auto-leiaut – we get a “layer cake” that crumbles from the first change
  • Colors come as hex, not as a reference to a variable - the design system bypasses
  • Instead of the Button instance, a copy is drawn in layers – the library degrades with each import
  • div, div 2, Frame 1247 layer names – searching and navigating the file turns into pain

Scenarios where Code-to-Canvas really pays off

Scenario 1: Design Review of AI-Generated UI

The developer for the evening gathered in Cursor ten screens of new onboarding. Previously, the designer either watched live in the browser (without the ability to offer an alternative in the layout), or redraw everything in Figma manually. Now the screens come in layers: you can immediately highlight where the indentations are not from the system, where the component is not used, where the header hierarchy went.

Scenario 2: Documentation of an existing product

In large products, live screens have long diverged from layouts. Code-to-Canvas allows you to periodically "take a cast" of the real state - not in screenshots, but in layers - and compare with the reference library. The discrepancies are immediately visible: where the component was customized in the code, where local styles appeared, where the design token did not reach.

Scenario 3: Quick iteration on the existing screen

Sometimes it’s faster to change the code, run it back to Figma and discuss it with the team than to draw a layout from scratch. Especially for dense tabular interfaces and admins, where hands to recreate a structure is a clock, and from the code it comes in seconds.

When the script doesn’t work

  • Conceptual phase where there is no code yet and should not be
  • Marketing landing pages with a unique composition – there are layers of code usually poorer than ideas
  • Teams without a design system: nothing to import, everything arrives like a raw set of frames

Segment summary

Code-to-Canvas is not about “no longer needing a designer.” This is about the fact that the code and layout finally become one graph, between the nodes of which you can walk in both directions. Next, we will discuss how to configure a pipeline, what should be in the code so that it is imported meaningfully, and how not to turn a Figma file into a dump of auto-generated frames.

How Pipeline Works in Practice

Between "developer pressed a button" and "designer saw editable layers in Figma" is usually a chain of three links: source code, mapping to the design system, importer. If at least one link is configured crooked, the output is garbage, which is easier to throw out than to repair.

What should be in the code to be imported meaningfully

Import is only as good as the source code. Minimum set:

  • Components are named as in the Figma library, not Wrapper, Box, Container2
  • Styles go through design system tokens (CSS variables, theme tokens), not literals
  • The layout structure repeats the logic of the frame: one flex-container – one autolayout
  • Icons are connected as components from a common set, not svg online
  • There is a code connect mapping (or its analogue) in the code that clearly says: this <Button variant="primary"> is this instance in the library

If the developer has generated a screen in Cursor with one prompt without connecting the system, a “wild” JSX comes to the importer, and any layers on the output will be just as wild.

What should be in a Figma file

  • Published library with meaningful names of components and variants
  • Variables for color, typography, indentations, radii
  • A separate Imports or Inbox page where fresh imports fall before the review
  • Agreement that import moves to the main pages only after verification

Diagnosis: Why Imports Are Bad

When the layers come and look strange, don't fix them point by point. First, find out which link is broken.

Симптом Где искать причину
Цвета как hex, не как переменные Маппинг токенов или отсутствие переменных в Figma
Вместо инстансов — нарисованные копии Code connect не настроен или имена расходятся
Поехала иерархия, всё в одном фрейме Верстка в коде через абсолютное позиционирование
Текст без text style В коде нет токенов типографики, инлайн font-size
Имена слоёв вида div, Frame 12 Импортёр не получил семантических имён компонентов

The rule is simple: fix on the side of code and mapping, not straighten each import with your hands. Otherwise, after a month, you spend more time cleaning than you saved on a review.

Typical team mistakes

  • Import everything in a row to the main file. After a week in the library, there are three versions of one button: real, imported and another “temporary”
  • The designer thinks that this is the task of the front; the front is that of design systems. Mapping isn't done by anyone
  • Import is used as a substitute for design. The designer stops thinking with the layout and just comments on what has arrived. Interface quality degrades quietly
  • Ignoring drift. Imports show code diverged from layouts, but the team continues to draw "as it should be" rather than fix the discrepancy

How to Incorporate This into the Workplace

Checklist before import

  • Figma has a current library with variables
  • The code uses a design system, not local styles
  • Configured mapping between code and figma components
  • There is a separate place (page, file) where fresh imports fall
  • It is agreed who and when watches inbox

Questions for Imported Screen Review

  • Are all the components from the library, or are there “painted” copies?
  • Colors, typography, indentations - variables or hardcode?
  • Is the layer hierarchy readable, or is it a flat frame salad?
  • What is different in this screen from the layout, and why: the conscious decision of the developer or drift?
  • If you move one block, will autolayout survive, or will it fall apart?

Where it fits into the week

One or two slots are usually enough in the team: for example, at the beginning of the sprint, the designer passes through the inbox of imports for a week, notes discrepancies, starts tasks on the mapping and on the front. It takes an hour and a half and removes most of the hidden drift.

Segment summary

Code-to-Canvas does not start to benefit from the moment the plugin is installed, but from the moment the team has a design system on both sides and a clear mapping between them. Next, let’s see how this approach changes the role of the designer in the product cycle and where he has boundaries beyond which to climb.

Advanced Scenarios: Where Code-to-Canvas Maximizes

The basic case "front sent the screen - watched in Figma" - this is only the beginning. It becomes more interesting when imports are integrated into more complex processes.

Scenario 1: Live code A/B test, Figma review

The team spins several screen options through featureflags. The designer doesn’t see them in production because they don’t get into the right segment. Importing each variant into a separate frame in Figma gives a normal surface for conversation: here's option A, here's B, here's what's different, that's why one loses on metrics.

Without this, the designer discusses screenshot options in Slack, and after two weeks, no one remembers what exactly was tested.

Scenario 2: Audit of discrepancies between layout and product

Take the page from the layout and the same page imported from real code. Put it next to you. Then - literally visual diff: where the indentations went, where the component was replaced by self-painted, where there was an extra thread.

It's not to poke the front with your nose. This is to understand whether the discrepancy is an implementation bug, a deliberate compromise, or a signal that the layout was unrealistic.

Scenario 3: Documentation of existing product

Legasi-product without relevant layouts is a common story. Instead of redrawing everything with your hands, it makes sense to run key screens through imports and get an editable base. Next, you have to brush it: rename the layers, pull up to the library, mark where the components live a separate life.

This is a dirty job, but many times faster than restoring layouts from scratch on screenshots.

AI generation and Code-to-Canvas: where to be more careful

“Product Writes Prompt – LLM Generates Code – Code Flies to Figma” sounds like a dream, but that’s where it breaks the most.

What's wrong

  • LLM regenerates components instead of using existing ones from the library. At the exit - ten different "cards", none of them is mappy
  • The model comes up with tokens that are not in the system: color-primary-450, although you only have 400 and 500
  • The generated code is ESLint, but semantically garbage: <div> instead of <Button>, online styles, no aria
  • Something visually similar comes to Figma, and the team takes it for a working artifact

How to insure

  • Prompt the model with the explicit context of the design system: a list of components, tokens, rules
  • Run the generated code through the same linker and code connect as the regular code
  • Agree that the AI import always falls into a separate page marked ai-draft, and the library does not go to manual verification
  • Asking, “Is it generated or written?” is not to prohibit, but to understand the level of trust

How to explain the approach to the team

Implementing Code-to-Canvas is not about plugins, but about agreements. And this is where the designer often fails: puts the instrument, waits for the magic, doesn't get it, blames the tool.

What to tell the fronts

  • I don’t need you to paint in Figma. I need to see what's real in the code
  • “If your component in the code is the same as the library component, import will show that. If not, this is a reason to discuss, not a claim
  • Mapping is a one-time job, then it pays off on each review

What to say to the product

  • The drift between the model and the product is not visible until it is measured. Imports make it visible n
  • This reduces the amount of "it should have been like this" debate -- because there's a single artifact
  • This does not speed up the design, but speeds up coordination and reduces the amount of rework

Anti-patterns in implementation

  • One product, one flow, two weeks - then expand
  • No success metrics. Agree in advance what you consider a victory: fewer discrepancies, faster review, less "and why in the sale is different"
  • **Implemented by one designer alone. If the front doesn't know why, the mapping won't show up and everything will fall apart

Questions to be answered before the start

  • Who is the owner of the mapping and where does he join?
  • Where are the “raw” imports and who is watching them?
  • What do we do when imports show a discrepancy: fix the code, fix the layout or fix it as conscious?
  • How do we deal with AI-generated code – a single track or a shared thread?
  • What are the signs in a month that the approach works?

Segment summary

Advanced Code-to-Canvas scripts are not about a cooler plugin, but about the fact that the team has a common language between the layout and the product. AI adds speed and noise at the same time, so separate hygiene for generated code is not paranoia, but a necessity. In the final segment, we will examine how this approach changes the role of the designer and where he has boundaries.

Code-to-Canvas Readiness List

Before dragging imports into production flow, go through the list. If at least half of the items are not closed, it will be an expensive toy, not a working tool.

Before the first import

  • The code has a component library that all fronts actually use
  • These components have names that match the names in the Figma library (or a correspondence table)
  • Design tokens are made separately: colors, indentations, typography are not magical numbers in styles
  • Figma has a separate page or file under ai-draft and code-import, not in the main library
  • There is a person who owns the mapping – not the whole team, but a specific nickname
  • We agreed on what to consider a success in a month: fewer discrepancies, faster revisions, fewer alterations

On every import

  • Imports arrive at the service page, not in combat models
  • The layers are renamed or at least grouped in meaning
  • Checked: what pulled up as a component of the library, and what remained a separate fragment
  • Differences are recorded in the list - even if we do not fix today
  • If the code is generated by AI, it is clearly marked in the frame name

Once in a sprint

  • We went through the list of discrepancies: what was closed, what was hanging, what was deliberately left behind
  • Reviewed mapping: whether new components appeared, whether the old died out
  • Checked that the fronts still know why it is and what to do with it

Anti-patterns that occur most often

"Import instead of design."

The designer begins to draw immediately in the imported layers, bypassing the design stage. After a month, layouts are slightly combed casts from production, not design solutions. Imports should be a mirror, not a canvas.

"Mirror without reflection"

Imports are set up, it works, but no one looks at it. The discrepancies accumulate, the garbage pages grow, and at one point the team quietly agrees to ignore it all. If the review does not ask the question "what is in the import?" - the tool is dead.

"Mupping as a one-off project"

Components matched once, reported, forgotten. After two releases, half is no longer relevant. Mapping is not a project, but hygiene, like renewal of addictions.

“AI import as usual”

The generated code arrives in the general stream, and no one remembers that it is a draft from the model. Within a week, it is already accepted as a fact. Label the source at the frame level, not just in your head.

One Hero

One designer put it all in, set it up, keeps it all. Going on vacation, the system stops. If the approach didn't survive the author's vacation, it doesn't.

Questions for revision layout and import

These questions are worth asking on a project review when the layout and import from the code lie nearby.

  • What in import is different from the layout - and is it a bug, a feature or a conscious one?
  • What parts of the code don’t fit into the library? Why?
  • Are there layers in imports that we didn’t put into the design at all?
  • What tokens in the code are not from the system? Is it new or is it amateur?
  • If this frame is generated by AI, who checked it with their eyes and when?
  • What do we do with the discrepancies found at the end of the sprint: fix, fix as a technical debt, or close as a conscious decision?
  • Are we ready to show this import to the product or do we still need to comb it?

Short practical outcome

Code-to-Canvas works not when the plugin is installed, but when the team agrees on what it believes to be true – the layout or the code – and when. The checklist and anti-patterns above are not about “setting the tool right,” but about making sure the approach has hygiene and an owner. AI adds noise, so the generated code lives in a separate track marked and undergoes the same test as a human, otherwise it quickly becomes “like a fact,” which it is not. Start with one flou, one person-owner, and one success metric in a month’s time – that’s enough to know if the team approach will stay or not.

$ cd ../ ← back to Figma and layouts: practical AI-assisted interface work