Skip to main content

Function: toFlatTokens()

toFlatTokens(theme, options?): Record<string, string | number>

Defined in: roots/helpers.ts:236

Flatten a ThemeTokens into a Record<string, string | number> with every {ref} recursively resolved to its final raw value where possible.

By default, unresolvable references (missing target or circular dependency) are preserved as-is in the output. Pass { strict: true } to instead throw on any unresolved reference — useful in tests and build steps that must fail loudly on palette drift.

This is the universal primitive — every root is derived from this.

Parameters

ParameterType
themeThemeTokens
options{ strict?: boolean; }
options.strict?boolean

Returns

Record<string, string | number>