Rules Hub
Code Ruleset
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP2universalStack: TypeScript
namingabstractiondesign-system
Allow abstraction-level names to differ from underlying design tokens
A prop's value set (e.g. Button color names) is an abstraction over the palette and need not exactly mirror token names.
PR: hegnar-zephr-components · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | // insisting color prop values exactly match $grey-100/$grey-200 token names |
Explanation (EN)
Coupling every variant name to a palette token exposes implementation details to consumers.
Objašnjenje (HR)
Good example
New codetypescript
| 1 | color?: 'blue' | 'grey-light' | 'grey-very-light' | 'red'; // abstraction over palette |
Explanation (EN)
Objašnjenje (HR)
Notes (EN)
For component variants, separate consumer-facing semantic choices from the concrete design tokens used to implement them.
Exceptions / Tradeoffs (EN)
Expose exact token names only when that is the intended theming API; retain established public variant names during refactors.