📐Semantic Token
Also known as Alias Token, Purpose Token, Decision Token
A token named for its job, like color-danger. It points to a raw value.
Think of it like
It is like a job title. The title says teacher, and the person filling it can change.
Example
color-background points to white in the light theme and to near-black in the dark one. No component changes.
Why it matters
A new theme or a new brand look is then just a change of pointers. Nothing is rewritten.
Definition
Example code
css
:root { --color-background: var(--white); }
[data-theme="dark"] { --color-background: var(--grey-900); }Common mistake
Key takeaways
- 1Named for the job. Text, danger, surface.
- 2Points to a primitive. Holds no raw value.
- 3Makes themes easy. Swap the pointers.