Skip to content

wrapperCollapse

disposition: bound, direction: figma-to-spec, basis: implementation

An anatomy rule of the Figma binding. The element types named below resolve jointly here — which type a node becomes, or what tag and semantics an element takes, is decided by this rule rather than per type.

Keys. container, text, glyph

Operands

Every fact the rule reads. Nothing outside this set participates.

OperandFrom
settings.spec.collapsePrimitiveWrapperdeclared settings
root.childrenthe root container’s anatomy-visible children, per variant
root.stylesthe root’s non-default style keys, after default removal

Derived predicates

NameExpressionSource
derived.semanticFrameroot.styles = carries any disqualifying key — clipsContent, cornerRadius, strokes, strokeAlign, strokeWeight, itemSpacing, padding, effects, backgroundColor, cornerSmoothingcapture-side collapse eligibility — a non-default value on one of these means the container is a semantic frame, not a Figma wrapper

Cases

Ordered — first match wins.

#WhenEmitsWhy
1settings.spec.collapsePrimitiveWrapper = true and root.children = exactly one, in every variant and derived.semanticFrame = falseone anatomy element where Figma has two layers — keyed by the wrapper, typed by the leaf
positioning and base keys conveyed from the wrapper always; size keys conveyed only where the leaf lacks its own
the pre-collapse layer name in $extensions['com.figma'].name; a role the collapsed child carried in childRole
ADR-058: the wrapper existed for Figma’s sake, so the spec records the one element the design means — provenance keeps the round trip honest (ADR-083’s collapse family)

Otherwise

no collapse — both layers stay elements — All-or-nothing across variants: one ineligible variant means no variant collapses, or the same element would exist in some variants and not others

A cross-concern rule: it rewrites anatomy, element styles and binding refs together.