References

Learn how to reference and reuse token values throughout your design system. References keep your tokens connected and your system maintainable.

Dollar References

Reference other tokens using the $ prefix. Arithmetic expressions work directly without needing calc().

Basic References

Change baseSpacing — watch others update.

Basic References Reference other tokens using the $ prefix. Arithmetic expressions work directly.

Nested References

Reference nested tokens using dot notation:

Nested References Reference nested tokens using dot notation.

Forward References

References are order-independent — you can reference tokens defined later in the file:

Forward References References are order-independent — you can reference tokens defined later in the file.

Ellipsis References

Use $... to reference tokens relative to the current scope. The ellipsis searches upward through parent scopes.

$...base finds spacing.base from within spacing
Ellipsis References Use $... to reference tokens relative to the current scope. The ellipsis searches upward through parent scopes.

Collection Access

Access items from arrays and scales using bracket notation with 1-based ordinal indexing.

Single Items

Access by position (1-based). Negative indices count from the end.

$sizes[1] is "xs", $sizes[-1] is "xl"
Single Items Access by position (1-based). Negative indices count from the end.

Named Positions

Use semantic names instead of numbers:

Named Positions Use semantic names instead of numbers.

Ranges

Extract subsets with inclusive ranges. Use a step value to skip items.

Ranges are inclusive: [2..4] gives positions 2, 3, and 4
Ranges Extract subsets with inclusive ranges. Use a step value to skip items.

Predicates & Unions

Use [odd], [even] predicates or comma-separated lists to select multiple items.

Predicates & Unions Use [odd], [even] predicates or comma-separated lists to select multiple items.

Getting Keys

Use .key to get the token name instead of its value. Works with single access, ranges, and predicates.

.key returns names like "gu01", "gu02" instead of values
Getting Keys Use .key to get the token name instead of its value. Works with single access, ranges, and predicates.

Advanced Access

Combine ellipsis references with collection access, and use arithmetic in selectors.

Ellipsis + Collections

Use $... with bracket notation to access collections from parent scopes:

Ellipsis + Collections Use $... with bracket notation to access collections from parent scopes.

Arithmetic in Selectors

Use +, -, *, / inside brackets for dynamic indexing:

Arithmetic in Selectors Use +, -, *, / inside brackets for dynamic indexing.

Step Navigation (.scope)

When a token references a scale item (like $spacing.sp03), use .scope to access its parent scale, and navigate relative to its step position using math operators (-, +, *):

Step Navigation (.scope) Access a referenced token's parent scale with .scope, then navigate relative to its step position.

Indexing rules: All indexing is 1-based (ordinal). $items[0] is an error. Ranges are inclusive: [2..4] includes positions 2, 3, and 4. Single access is strict (errors if out of bounds), range access is safe (clamped).

Next: Expressions — arithmetic, method chaining, interpolation, and color functions.