Skip to content

CSS

Platform binding for the Specs document format — draft.

Normative frame: SPECIFICATION.md §11. This document states how the CSS binding realises the schema; it does not restate what the members mean — that is the reference at /schema.

Generated from mappings/bindings/css.json by scripts/build-mappings.mjs. Edit the binding file, never this page.

Rules

The rules that resolve jointly — where no single key or kind determines any single output, the rule’s ordered case table IS the mapping, on its own page. Keys and kinds in the surface tables below link back here through their rule column.

RuleSurfaceKeys
elementSelectorsAnatomytext, glyph, vector, container, slot, instance, line, ellipse, rectangle
propsToSelectorsPropsboolean, enum, number, object
absolutePositioningStylesposition, top, bottom, start, end, centerHorizontalOffset, centerVerticalOffset
autoLayoutStyleslayoutMode, mainAxisAlignment, crossAxisAlignment, wrap, wrapAlignment, itemSpacing
autoLayoutSizingStyleslayoutSizingHorizontal, layoutSizingVertical
intrinsicSizeStyleswidth, height, aspectRatio
strokeRenderingStylesstrokes, strokeAlign, strokeWeight
textTruncationStylestextOverflow, maxLines

Styles

31 bound, 11 approximated, 6 unsupported, of 48 style keys.

A key whose row says rule does not map on its own — its rule is a case table on the rule’s own page. Writing a per-key mapping for it would be false, not merely incomplete.

DispositionKeysMeaning
bound31Realised, and confirmed against the implementation
approximated11Realised with loss, and the loss is stated
unsupported6Declared as not realised, with the resulting behaviour stated

Every row below is a claim a reader may rely on.

Style keyDispositionRealised by
aspectRatioboundrule intrinsicSize
bottomboundrule absolutePositioning
centerHorizontalOffsetboundrule absolutePositioning
centerVerticalOffsetboundrule absolutePositioning
clipsContentboundlayoutToCSS, overflow, truncation
crossAxisAlignmentboundrule autoLayout
endboundrule absolutePositioning
gridColumnsboundrule autoLayout
gridRowsboundrule autoLayout
heightboundrule intrinsicSize
itemSpacingboundrule autoLayout
layoutModeboundrule autoLayout
layoutSizingHorizontalboundrule autoLayoutSizing
layoutSizingVerticalboundrule autoLayoutSizing
mainAxisAlignmentboundrule autoLayout
maxLinesboundrule textTruncation
opacityboundopacity
positionboundrule absolutePositioning
rotationboundtransform
startboundrule absolutePositioning
strokeAlignboundrule strokeRendering
strokesboundrule strokeRendering
strokeWeightboundrule strokeRendering
textAlignHorizontalboundtextAlign
textColorboundfills
textOverflowboundrule textTruncation
topboundrule absolutePositioning
visibleboundeffects, layoutToCSS, visibility
widthboundrule intrinsicSize
wrapboundrule autoLayout
wrapAlignmentboundrule autoLayout
backgroundColorapproximatedfills
backgroundImageapproximated—
cornerRadiusapproximatedcornerRadius
effectsapproximatedeffects
fillColorapproximatedfills
maxHeightapproximatedsize
maxWidthapproximatedsize
minHeightapproximatedsize
minWidthapproximatedsize
paddingapproximatedpadding
typographyapproximatedtypography
cornerSmoothingunsupported—
itemReverseZIndexunsupported—
lockedunsupported—
primaryAxisSizingModeunsupported—
strokeDashPatternunsupported—
textAlignVerticalunsupported—

Props

A prop is declared once in the spec and realised differently by kind on each platform. Unlike a style key, a kind may carry its own row and be governed by a rule — a kind is a population of props, and different populations of it resolve differently.

Prop kindDispositionRealised by
booleanboundCss, states · rule propsToSelectors
enumboundCss, enumCase · rule propsToSelectors
numberboundCss · rule propsToSelectors
objectboundCss · rule propsToSelectors
imageunsupported—
slotunsupported—
stringunsupported—

Anatomy

An anatomy element’s names are the library’s; its TYPE is the contract’s, and the type is what each platform realises. A type may carry its own row and be governed by a rule — a type is a population of elements, and which type a node even becomes is itself a joint rule.

Element typeDispositionRealised by
containerboundCss · rule elementSelectors
glyphboundCss · rule elementSelectors
instanceboundCss · rule elementSelectors
rectangleboundCss · rule elementSelectors
slotboundCss, contentStyles · rule elementSelectors
textboundCss · rule elementSelectors
ellipseapproximatedCss · rule elementSelectors
lineapproximatedCss · rule elementSelectors
vectorapproximatedCss · rule elementSelectors
polygonunsupported—
starunsupported—

Values and References

What a platform does with each form a VALUE may take — the scalar forms (a literal, the mixed sentinel) and the pointer grammar (SPECIFICATION §5.1’s six reserved-marker forms plus the $nested paths; DSPEC-42 for the style-value half). The set is closed: the safe key grammar admits no authored $-prefixed key, so no document can mint a new marker. Notes stay inline — the forms’ reference pages are hand-written and carry no generated binding section yet.

Reference formDispositionRealised byNotes
imageboundCssAn $image reaching a style value emits through backgroundImage as a custom property the emitting platform fills with the served URL.
literalboundCssThe ordinary case; every style rule’s case table is written against literals.
themeboundCssvarsA token group’s non-default themes each emit an override block selected by [data-theme-<group>="<theme>"], re-declaring every custom property whose value differs in that mode — so the attribute the emitters write on a selecting element scopes the override to that element’s subtree rather than the document. The attribute spelling has to match themeAttrs in @directededges/from-specs exactly; the two copies agree by discipline, and a prefix changed on one side alone is a block that matches nothing. A subscribed collection emits no block, because its per-mode values are not in the workspace’s fetched data, and the run names those collections rather than skipping them silently (ADR-123).
tokenboundtokensEmitted per settings.spec.tokens: a dedicated token-value path recognises $token and renders it in the configured notation.
bindingapproximatedCssA $binding never reaches a declaration. As selection it participates through the props surface; as a STYLE VALUE it is not applied — visible is the one possible exception and is not currently realised either, because the check is a literal false comparison a $binding object fails. Declared scope, not an unfound gap.
conditionalunsupported—Not yet implemented: nothing in the transform matches a conditional, so a visible carrying the ADR-018 form renders permanently visible and the condition is discarded. The Figma render path does implement it, so a document survives a round trip and loses the condition only on the way to CSS.
elementTypeunsupported—External type references are a consumer concern (ADR-012); the stylesheet keys off element keys, never type URIs.
mixedunsupported—A mixed value states that the property varies across the text it was read from, so there is no single value to emit. Nothing is emitted, and this row says so rather than leaving a consumer to guess. Applies equally to React and Web Components, which delegate styling here.
nestedunsupported—Deep configuration is structure, not styling; nothing to emit.
slotContentunsupported—Composition leaves no trace in a stylesheet: a fill’s own component styles itself, and the slot’s primitive formatting is the contentStyles surface, already declared under anatomy.
subcomponentunsupported—A subcomponent gets its own stylesheet; the reference itself emits nothing.

Defaults

What an absent style key means is spec-level, not per-platform: two platforms that answer differently disagree about what the same document says. It is declared once in the schema — each style key’s page marks its own default — and the ambiguity absence carries is stated on the Overview.

What this platform does on absence is its own fact, and is recorded per key below. A key whose behaviour is not declaredDefault disagrees with the contract — visibly, and as a decision rather than an accident.

BehaviourKeysMeaning
platformInitial48Applies the platform’s own initial value, which may differ from the schema’s declared default.

Seeded from the transform’s documented policy and not yet confirmed per key. A seeded value is a starting point, not a finding.

Losses

What this platform does is settled and stated above. Where a loss is real, its acceptability is a product question rather than a specification’s to settle alone. 6 of 48 keys raise one of 2 such questions, of which 2 remain open.

  • A value is dropped rather than degraded. Affects backgroundColor, effects. A gradient whose stops do not yield two resolvable colours is dropped whole. A padding side that is present but unresolvable is omitted while its siblings emit, whereas cornerRadius substitutes 0 for the same failure. DSPEC-43 says a degradation applies the spec’s own recorded fallback, or applies nothing and warns — dropping part of a value silently is neither. Open. See #816 on the disagreement between the composite types, and #815 on the gradient path.
  • Zero is not distinguishable from unset. Affects minWidth, minHeight, maxWidth, maxHeight. Both platforms currently treat a dimension of 0 as “no constraint” rather than “a constraint of zero”. Open. Deferred — see #814, and #812 on what an absent width/height means. The two interact and should be settled together.