Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Avoid a multi-key classes prop; prefer semantic markup with one root class
Instead of exposing a classes object to style internals, use a single root className plus semantic elements you can target in CSS.
Bad example
| 1 | <TimestampTag classes={{ root, timestamp, tag, categoryIcon }} /> |
Explanation (EN)
A large classes object exposes internal structure when a simple styling contract would suffice.
Objašnjenje (HR)
Good example
| 1 | <TimestampTag className={root} /> |
| 2 | // internally use <time>, <img>, etc. and target them in CSS |
Explanation (EN)
Objašnjenje (HR)
Notes (EN)
For a simple component, prefer semantic internal markup and a stable root styling hook when callers do not need independent control of internal slots.
Exceptions / Tradeoffs (EN)
A design-system slot/class API can be an intentional supported contract. Descendant CSS selectors can couple callers to implementation structure more strongly than explicit slots.