Import Variables & Styles
Import local Figma variables and styles into token JSON, with Smart/Strict/Generate mapping, config updates, and diff-id round-trip support.
What this feature does
Import Variables & Styles converts local Figma Variables and Styles from the current file into DTCG-compatible token JSON.
During import, SXL Studio can also:
- update or generate
config.json - update
diff-id.jsonfor future diff-safe export
This is the reverse flow of Export Variables & Styles.
Important scope
- Import works with local collections/styles in the currently opened Figma file.
- It does not use REST import pipelines.
- It can work with or without an existing
config.json.
How to open
- Open the Tokens tab.
- Click Import variables & styles in the bottom actions.
In the modal header, the UI title is currently Import from Figma.
What you select before import
Variable collections
- Source: local Figma variable collections.
- Header toggle = select all / clear all.
- If collections exist, you must keep at least one selected.
Style groups
- Source: local Figma text/paint/effect/grid styles.
- Grouping rule: first style path segment (
Group/Name-> groupGroup). - If groups exist, you must keep at least one selected.
Type filters
Only enabled types are imported.
Variables
| Toggle | Figma resolved type |
|---|---|
color | COLOR |
number | FLOAT |
string | STRING |
boolean | BOOLEAN |
Styles
| Toggle | Figma style kind |
|---|---|
typography | Text styles |
fill, gradient | Paint styles |
shadow, blur, effects, glass | Effect styles |
grid | Grid styles |
border | Reserved in schema/UI; no standalone Figma border style import in current runtime |
Config mapping modes
| Mode | Runtime key | Behavior |
|---|---|---|
| Smart (default) | smart | Uses existing config routes where possible; adds missing collections/modes/files for selected data; merges alias-derived ref dependencies; may save updated config.json. |
| Strict | from-config | Imports only into paths already declared in config.json; unknown collections/modes are skipped with warnings. |
| Generate | generate | Builds greenfield collection/mode/file layout from selected Figma collections and saves it to config.json. |
If Strict is selected in UI while no valid config is available, the run is blocked until you switch mode.
Import behavior options
| Option | Runtime field | Meaning |
|---|---|---|
| Multi-file layout (greenfield) | fileLayout | For generated/greenfield paths: split into multiple files per mode (multi-file) or one file per mode (single-per-mode). |
| Overwrite existing token values | conflictPolicy | ON = overwrite, OFF = merge-only (merge-only). |
| Preserve variable aliases as {paths} | aliasPolicy | ON = keep aliases (preserve-path), OFF = literalize where possible (literalize). |
| Map Figma scopes -> $extensions | readScopesToExtensions | Writes figma.scopes into imported variable tokens (best effort). |
| Update diff-id.json | updateDiffId | Stores imported Figma IDs and hashes for round-trip export. |
| FLOAT -> dimension | floatSemantic | Controls FLOAT mapping: dimension (default) or number. |
Where imported files are written
With Smart / Strict and config routes
Data is written into enabled paths from config.json (collections[].modes[].files).
With Generate (or Smart greenfield additions)
A new route layout is created under:
<collection-slug>/<mode-slug>/...
Style fallback path
If no route is available for styles, importer can write to:
styles/imported-styles.json
How values are serialized
- Variable aliases become
{token.path}when alias preservation is enabled. - Bound style variables (for typography, paint, effects) are serialized with the same alias policy.
- Imported token paths are normalized from Figma names.
Current limitations and notes
- Image paint styles import as
imgwith empty URL placeholder ({ "url": "" }). - Some complex effects may be imported as an
effectsobject and require manual cleanup. - Strict mode depends on an accurate
config.json; missing routes are skipped. - Import updates only selected collections/groups and enabled type toggles.
Minimal result example
JSON
{
"color": {
"brand": {
"primary": {
"$type": "color",
"$value": "#0057ff"
}
}
},
"typography": {
"body": {
"md": {
"$type": "typography",
"$value": {
"fontFamily": "Inter",
"fontSize": "16px",
"lineHeight": "24px"
}
}
}
}
}