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 ruleP1stack specificStack: React
radixdialogcontrolled-componentsreact
Use defaultOpen for an initially-open dialog, open only when controlling state
Radix Dialog's open prop is for controlled state and must be paired with onOpenChange. To simply start open, use defaultOpen.
PR: hegnar-components · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetsx
| 1 | <Dialog.Root open> {/* controlled but no onOpenChange; cannot close */} |
| 2 | ... |
| 3 | </Dialog.Root> |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | <Dialog.Root defaultOpen> {/* uncontrolled, starts open, closes itself */} |
| 2 | ... |
| 3 | </Dialog.Root> |
Explanation (EN)
Objašnjenje (HR)