Apply & Generate
Runtime behavior of Apply Data and Generate instance in SXL Studio: scope, value application rules, auto-hide, row generation, and Figma limitations.
Apply Data
Apply Data executes mapping rules and writes dataset values into matching Figma nodes.
Apply pipeline
- Build field map from all mappings (
Target Layer -> fields). - Collect target nodes in selected scope.
- Resolve dataset for each field (field dataset -> mapping dataset -> auto-detect).
- Compute row index (fill strategy + group fill mode + selection context).
- Evaluate expression and resolve directives/images/text.
- Run optional post-passes:
- Auto-hide unused
- Slot repeater
- Composition templates (
{{ ... }})
Scope
| Scope | Behavior |
|---|---|
selection | only selected roots and descendants |
page | current page |
document | all pages |
selection is the safest default for iteration speed.
Field ordering when multiple mappings hit the same target
Apply prioritizes fields in this order:
- group
cell/table, - groups starting with
cell/, - remaining fields (stable by mapping id).
Value handling matrix
| Input value | Target node | Result |
|---|---|---|
| plain text | TEXT | updates characters |
| image source | image-capable node | sets IMAGE fill |
@prop:... | INSTANCE context | sets component properties |
@node:..., @hide, @show | node / parent container | node property updates |
@rows:N | container with children | shows first N children |
| boolean-like value | INSTANCE | sets first BOOLEAN component prop |
Auto-hide unused: actual behavior
When autoHideUnused=true and feature is available:
- auto-hide runs per resolved row/container boundary,
- it hides unused TEXT nodes in that boundary,
- mapped targets and touched nodes are protected,
- this is not “hide when value is empty” logic; it is mapping-target based cleanup.
Generate instance
Generate instance duplicates a template and applies one dataset row per generated row.
Preconditions
- Generate feature must be enabled.
- A mapping must be selected (Generate picker shows
.map.jsonfiles with at least one field). - Dataset for that mapping must have rows.
- Selection must be a valid template context (instance/component or frame/list host).
Row count
All: generate for all dataset rows.Limit: generatemin(limit, datasetRows).
High-level generation flow
- Resolve container + template from current selection.
- Optional
Bind componentvalidation (targetComponentKey). - Clean previous siblings in container, keep template anchor.
- Duplicate rows and insert them in order.
- Run Apply for generated rows using the selected mapping.
- Resolve composition templates per row (
{{...}}). - Select generated nodes.
Duplication strategy
Frame/list hosts
- row 1: existing template,
- row 2: clone of template,
- row 3+: clone of previous inserted row.
Slot hosts
- default slot mode: row 2 from template, row 3+ from previous row,
- table-row slot mode: every new row clones from previous row.
This strategy is used for stability with nested instance trees.
Apply phase after Generate
Generate applies:
- the selected mapping to generated rows,
- composition templates for each row.
Other mappings are not automatically applied in the current default pipeline.
Known Figma constraints (important)
1) Nested slot/table ghost row
For deep structures like WTable -> rows(SLOT) -> row(INSTANCE), Figma may keep one master-inherited row that cannot be safely removed by plugin API.
If cleanup cannot evict/hide it, a one-time notification is shown and manual deletion is required.
2) Performance floor on deep nested instances
Text writes on deep instance sublayers can be very slow (hundreds of ms per cell), especially in nested table setups.
For large datasets, prefer flat frame/auto-layout row templates when possible.
3) Font availability
Plugin preloads fonts, but unavailable fonts can still block text updates.
Practical recommendations
- Start with
Selectionscope for safe iteration. - Keep target layer names explicit and unique.
- Enable
Bind componentfor strict template validation in Generate. - For large tables, split batches or use flatter row structures.
- Treat slot/table edge notifications as API constraints, not necessarily mapping errors.
Related pages
- Keys, directives, JSON schema: Data files & mappings
- General workspace and workflow: Database overview