Dev Mode

Code generation

How to get code for the selected layer: the Code panel in Figma Dev Mode and the plugin's Code tab, the Vue 3, React, SwiftUI, UIKit, Kotlin, DivKit and JSON languages, sections, the Styled, Decomposed and Raw modes, the Codegen settings window and icon naming rules.

The plugin generates code for the selected layer in two places, and the result is the same in both:

WhereHow to openPurpose
The Code panel in Figma Dev ModeSelect a layer, choose an SXL Studio language in the Code panelA quick look without opening the plugin
The plugin's Code tab in Dev ModeOpen the plugin from the Dev Mode plugin list, select a layerSections, view modes, generation settings, copying

Languages

LanguageWhat you get
Vue 3A single-file component: <script setup lang="ts">, template, styles with CSS variables
ReactA function component in .tsx with typed props, CSS Modules and clsx
JSONA composition description: structure, component properties, styles
SwiftUISwift code referencing the token enum
UIKitA UIView class with stacks, labels and images
KotlinKotlin Compose with token constants
DivKitA card JSON document for mobile apps on DivKit

In Figma's Code panel the languages have the same names, JSON is labelled JSON (Design).

The plugin's Code tab

The Code tab: the Vue 3 language, the All section, the Decomposed and Raw toggles, the Copy button and the Codegen settings gear.

ElementWhat it does
Language listVue 3, React, SwiftUI, UIKit, Kotlin, DivKit, JSON
Section listAll, Template, Script, Styles, Variables, References. SwiftUI and Kotlin have no Script section
DecomposedSplits composite styles into individual properties; variable references are kept
RawSubstitutes final values for variables. Always decomposed output
CopyCopies the current section
GearOpens Codegen settings for this Figma file

The language list on the Code tab.

The Variables and References sections are the same for every language: the first shows which variables were collected from the selection, the second lists nested components and warnings. For JSON the sections are read by meaning: Template shows the structure, Script the root fields, Styles the styles.

View modes

ModeHow to enableWhat happens to tokens
StyledBoth toggles offReferences to composite styles are used, for example text styles and effect styles; variables are kept
DecomposedDecomposed onComposite styles are split into individual properties; variables are kept
RawRaw onValues are substituted as literals, with no variable references

Styled is not absolute: if a layer has no suitable style reference, the generator takes the actual values. On very large trees the output may be truncated, and a note about it appears in the code.

The Code panel in Figma

In the native Code panel every language provides a set of tabs. For example, Vue 3: All, Script Setup, Template, Styles, Variables, Reference components; React: All, Template, Script, Styles, Variables, Reference components; the mobile languages: the main file, Variables and Reference components. If the component is linked through Code Connect, tabs with the import and a usage example are added. The Debug tab appears only when a debug trace exists.

Component sets

If a component set is selected, Vue 3 and React build one component with props for the variant axes and class mapping, and DivKit builds one card with a separate state per variant. The number of variants is shown in the tab title.

Codegen settings

The gear on the Code tab opens the generation settings for the current Figma file. Empty fields mean the defaults.

The Codegen settings window: the Naming, Styling, Imports and Mobile sections, the Reset and Save buttons.

SectionFields
NamingIcon component: the wrapper for icons. Icon name pattern: the icon name template. Bool collision and Swap collision: how to rename a boolean or instance-swap property when names collide
StylingRoot class: the root element class. Class case: kebab-case or camelCase. Header comment: a banner comment in stylesheets
ImportsComponent import path: the import path template, for example @/components/{Name}
MobileSwift token enum, Drawable prefix for Android, DivKit profile, DivKit validation, DivKit profile JSON
TestingTest attribute: an attribute for tests, for example data-testid. Empty means off
Icon rulesA list of icon naming rules by page, section, set, variant or description, Default pattern and Gate (description)

Placeholders in icon templates:

PlaceholderValue
{baseName}, {name}The normalized icon or layer name
{setName}The component set name
{pageName}The Figma page name
{sectionName}The nearest section
{variant.<axis>}The variant axis value

Rules are checked top to bottom and the first match wins. If none matches, Default pattern is used. Example: Icon component: Icon, Icon name pattern: {baseName}, a rule "if pageName = Icons and variant.Size = 24, then ui-{baseName}-{variant.Size}".

Language specifics

React. A component for React 19: .tsx, typed props, ReactNode for slots and swaps, CSS Modules and clsx, import paths from the settings, an optional test attribute. Slot layers become children, nested components are imported as tags.

UIKit. A UIView class with UIStackView stacks, UILabel labels and UIImageView images. Colours, dimensions, typography and effects come from tokens where possible. Explicit Figma modes are emitted as comments.

DivKit. A handoff-ready JSON: card and, when needed, templates. Token references become DivKit variables of the form @{token_name}; collections with several modes get a mode variable and a value dictionary. Frames and components become container, text becomes text, lines become separator. The References section lists placeholders and unsupported constructs: check it when the output does not match expectations.

DivKit has profiles and validation modes. DivKit profile: Generic suits any project, NewMain BDUI and Custom are opt-in. DivKit validation: Strict Playground keeps the output compatible with the public DivKit playground, Host App allows schemes and blocks declared in the project profile. The project profile is set in the DivKit profile JSON field:

JSON
{
  "icons": {
    "circle-info": { "image_url": "https://cdn.example.com/icons/circle-info.svg" }
  },
  "slots": {
    "slot.class:progress": { "type": "custom", "custom_type": "new_main_story_progress" }
  },
  "actions": {
    "cta": "div-action://open/details"
  },
  "fonts": {
    "SF Pro Display": "display"
  },
  "customTypes": ["new_main_story_progress"]
}

Icons become image nodes with an address, slots become containers, custom blocks or templates, actions become tap handlers, fonts become host aliases. If a mapping is missing or the validation mode forbids it, the plugin keeps a safe placeholder and writes the reason into References.

If the output is not what you expected

  1. Toggle Decomposed and Raw to separate token behaviour from values.
  2. Open the Variables section and check which variables were collected from the selection.
  3. Make sure the right layer is selected: a component, a nested layer or a component set give different results.
  4. In Figma's Code panel look at the Debug tab if it appeared.