Design System GuideDS Guide
Docs
Docs
18. Component API Design18.1 Prefer semantic props18.2 Avoid boolean explosion18.3 Composition over mega-components18.4 Controlled vs uncontrolled APIs18.5 Escape hatches
19. Patterns, Templates, and Product-Specific Components
18. Component API Design

18.4 Controlled vs uncontrolled APIs

Component API Design · Section 18.4

Example:

<Dialog
  open={open}
  onOpenChange={setOpen}
/>

or:

<Dialog defaultOpen />

Support both only when complexity is justified.

18.3 Composition over mega-components

Component API Design · Section 18.3

18.5 Escape hatches

Component API Design · Section 18.5