tokenPathToCssVarName

Theme
stable

Resolve a token path array to an origam CSS variable name (WITHOUT the leading `--`). Applies the Origam naming convention: triple-tiret for property, double-tiret for state/BEM-child, and `__` for BEM child elements.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

path
required
ReadonlyArray<string>
Ordered path segments from the token JSON. The first segment is always the block name (e.g. `"btn"`, `"color"`). Subsequent segments encode state, BEM child, or property parts.
isComponent
required
boolean
True for component tokens (`tokens/component/*.json`), false for primitive/semantic tokens. Selects which naming branch is applied.

API

Return value

The value returned by this util.

The CSS variable name without `--`, e.g. `"origam-btn--primary---background-color"` or `"origam-color__neutral---500"`.

Usage

Examples

Ready-to-paste usage snippets.

Encode component token paths with state and BEM child

typescript