Skip to content

TokenReference

A reference to a design token, following the Design Tokens Community Group (DTCG) format. Token references appear wherever a style value can be a token instead of a literal.

Members

$token

The dot-separated path to the token, e.g. "DS Color.Text.Primary" or "DS.Space.400".

$type

One of: color, dimension, string, number, boolean, shadow, gradient, typography, effects, image, colorStack.

The last three are Specs extensions for shapes DTCG has no type for: a group of effects, a fill style whose paint is an image, and a fill or stroke style holding two or more paints. A style holding one paint keeps color or gradient.

$extensions

Optional vendor-specific metadata. The com.figma extension includes:

PropertyTypeDescription
idstringFigma variable ID
namestringFigma variable name
collectionNamestringVariable collection name
rawValuestring | number | booleanResolved raw value

Examples

Color

Color variables bound to fills, strokes, or text color:

backgroundColor:
$token: DS Color.Surface.Primary
$type: color
$extensions:
com.figma:
id: VariableID:123:456
name: Surface/Primary
collectionName: DS Color
rawValue: "#FFFFFF"

Dimension

Numeric variables bound to spacing, sizing, padding, corner radius, or stroke weight:

paddingStart:
$token: DS Spacing.Space.400
$type: dimension
$extensions:
com.figma:
id: VariableID:200:10
name: Space/400
collectionName: DS Spacing
rawValue: 16

Typography (text style)

Named text styles produce a typography token. These reference the style as a whole rather than individual properties:

typography:
$token: Heading.H1
$type: typography
$extensions:
com.figma:
id: S:abc123
name: Heading/H1

Effects (effect style)

Named effect styles (shadows, blurs) produce an effects token:

effects:
$token: Elevation.Card
$type: effects
$extensions:
com.figma:
id: S:def456
name: Elevation/Card

Color stack (multi-paint fill or stroke style)

A fill or stroke style holding two or more paints produces a color stack token. The style’s paints live in the fetched styles data; the spec carries the reference:

backgroundColor:
$token: Overlay.Scrim on surface
$type: colorStack
$extensions:
com.figma:
id: S:ghi789
name: Overlay/Scrim on surface

A style holding one paint produces a color or gradient token instead, unchanged.

Boolean

Boolean-typed variables:

visible:
$token: Feature.ShowBadge
$type: boolean
$extensions:
com.figma:
id: VariableID:300:1
name: Feature/ShowBadge
rawValue: true

Further Reading