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.2 Avoid boolean explosion

Component API Design · Section 18.2

Bad:

<Button
  primary
  secondary
  destructive
  compact
  large
  rounded
  square
/>

Impossible combinations become easy.

Prefer enums:

<Button
  variant="destructive"
  size="lg"
/>

18.1 Prefer semantic props

Component API Design · Section 18.1

18.3 Composition over mega-components

Component API Design · Section 18.3