Layers
- raw token variables from
@vega-ui/tokens-core - semantic application variables from
@vega-ui/theme-core - component-local variables from
packages/ui/src/**/style.module.css
How The Layers Work Together
Example flow:
--color-blue-500is defined in the token layer- the active theme maps that scale into semantic variables such as
--color-blue-accent-500,--text-color, or--fills-primary - a component may then expose local variables such as
--select-value-coloror--select-size
That means component docs should distinguish three override levels:
- token override: broad system-level change
- theme override: semantic application change
- component override: targeted local tuning
Preferred Override Order
Start with the broadest safe level:
- adjust theme semantics when the change should affect many components
- adjust component-local
--component-*variables when only one component family should change - use direct style overrides only when neither tokens nor documented variables cover the case
This rule matters because raw token overrides spread across the whole system quickly, while semantic theme overrides remain predictable and component-local overrides stay contained.
Example
<Select
style={{
'--select-size': '44px',
'--select-value-color': 'var(--color-primary-700)',
} as React.CSSProperties}
>
{/* parts */}
</Select>In this example:
--color-primary-700comes from the semantic theme layer--select-sizeand--select-value-colorare component-local variables
Guidance
- do not treat every CSS custom property in source as stable public API
- prefer documented semantic variables over raw palette values
- keep theme concerns global and component overrides local