Skip to content

Styles

The Styles object holds visual properties for an element. Every property is optional. Which properties are evaluated depends on the element type.

type Styles = Partial<{ /* 48 properties */ }>;

Properties

NameCategoryEvaluated For
aspectRatiosizecontainer, slot, rectangle, text, vector, ellipse, star, polygon
backgroundColorcolorcontainer, slot, rectangle
clipContentvisibilitycontainer, slot
cornerRadiusbordercontainer, slot
cornerSmoothingbordercontainer, rectangle, vector, ellipse, star, polygon
crossAxisAlignmentlayoutcontainer
effectseffectscontainer, slot, rectangle, text, vector, ellipse, star, polygon, line
fillColorcolorglyph, vector, ellipse, star, polygon, line
heightsizecontainer, slot, rectangle, glyph, vector, ellipse, star, polygon
itemReverseZIndexlayoutcontainer
itemSpacingspacingcontainer
layoutModelayoutcontainer
layoutPositioninglayoutall
layoutSizingHorizontallayoutall
layoutSizingVerticallayoutall
lockedvisibilityall
maxHeightsizecontainer, slot, rectangle, glyph, vector, ellipse, star, polygon, line
maxWidthsizecontainer, slot, rectangle, glyph, vector, ellipse, star, polygon, line
minHeightsizecontainer, slot, rectangle, glyph, vector, ellipse, star, polygon, line
minWidthsizecontainer, slot, rectangle, glyph, vector, ellipse, star, polygon, line
opacityvisibilityall
paddingspacingcontainer
mainAxisAlignmentlayoutcontainer
primaryAxisSizingModelayoutcontainer
rotationtransformall
strokeAlignbordercontainer, rectangle, vector, ellipse, star, polygon, line
strokescolorcontainer, rectangle, vector, ellipse, star, polygon, line
strokeWeightbordercontainer, rectangle, vector, ellipse, star, polygon, line
textAlignHorizontaltexttext
textAlignVerticaltexttext
textColorcolortext
typographytexttext
visiblevisibilityall
widthsizecontainer, slot, rectangle, glyph, vector, ellipse, star, polygon, line
wraplayoutcontainer
wrapAlignmentlayoutcontainer
xpositionall
ypositionall

Key Mapping from Figma

Several spec style keys differ from the Figma node property they read from. Specs renames these to be more semantic and self-describing. Keys not listed here pass through unchanged (e.g. opacity reads node.opacity).

Spec keyFigma propertyADR
backgroundColorfillsADR 009
textColorfillsADR 009
fillColorfillsADR 013
wraplayoutWrapADR 039
wrapAlignmentcounterAxisAlignContentADR 039
mainAxisAlignmentprimaryAxisAlignItemsADR 040
crossAxisAlignmentcounterAxisAlignItemsADR 040

All other style keys — width, height, opacity, padding, itemSpacing, cornerRadius, strokeWeight, rotation, etc. — use the same name as the Figma node property.

Values

Most properties accept a Style value. Some properties accept specialized shapes instead of or in addition to Style.

NameDescriptionExample
stringLiteral string value"HORIZONTAL"
numberLiteral number value16
booleanLiteral boolean valuetrue
nullAbsent or cleared valuenull
TokenReferenceReference to a design token{ $token: "DS.Space.400", $type: "dimension" }
PropBindingDynamic link to a prop value{ $binding: "#/props/label" }
ConditionalValue that depends on a prop’s state{ if: { condition: ..., then: 8, else: 12 } }
GradientValueLinear, radial, or angular gradient{ type: "LINEAR", angle: 90, stops: [...] }
TypographyText style object with individual properties{ fontSize: 14, fontFamily: "Inter" }
EffectsShadows and blurs{ shadows: [...], layerBlur: { ... } }
SidesPer-side values for padding or stroke weight{ top: 8, end: 12, bottom: 8, start: 12 }
CornersPer-corner values for corner radius{ topStart: 4, topEnd: 4, bottomEnd: 0, bottomStart: 0 }
ItemSpacingPer-axis gap values{ horizontal: 16, vertical: 8 }
LayoutModeAuto-layout direction enum"NONE", "HORIZONTAL", "VERTICAL"
WrapAlignmentWrap line distribution enum"START", "SPACE_BETWEEN"
MainAxisAlignmentMain axis alignment enum"START", "END", "CENTER", "SPACE_BETWEEN"
CrossAxisAlignmentCross axis alignment enum"START", "END", "CENTER", "STRETCH", "BASELINE"
AspectRatioWidth-to-height ratio{ x: 16, y: 9 }

Relating properties to values

  • Most properties accept any Style (literal, token, binding, or conditional).
  • backgroundColor, fillColor, strokes, textColor accept string | TokenReference | GradientValue | null.
  • typography accepts TokenReference | Typography.
  • effects accepts TokenReference | Effects.
  • padding, strokeWeight accept Style | Sides.
  • cornerRadius accepts Style | Corners.
  • itemSpacing accepts Style | ItemSpacing.
  • layoutMode accepts LayoutMode | null — not token-bindable.
  • wrapAlignment accepts WrapAlignment | null — not token-bindable.
  • mainAxisAlignment accepts MainAxisAlignment | null — not token-bindable.
  • crossAxisAlignment accepts CrossAxisAlignment | null — not token-bindable.
  • aspectRatio accepts AspectRatio | null.