Rules Hub
Coding Rules Library
← 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 ruleP2stack specificStack: react
muipropscsstheming
Toggle component states via props, not duplicated CSS classes
Use a component's built-in state props (e.g. disabled) so its theme styling applies, instead of replicating the state with a custom CSS class that can fight the theme.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codetsx
| 1 | <Button className={styles.disabled}>Send</Button> |
| 2 | // .disabled { background-color: $blue-500; } overrides theme disabled style |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | <Button disabled>Send</Button> |
Explanation (EN)
Objašnjenje (HR)