Goal: component APIs that stay flexible as features grow.
Use for:
- components accumulating many boolean and config props
- shared UI that each consumer needs to customize differently
- replacing rigid components with composable ones
Workflow:
- Identify the variation points consumers actually need.
- Prefer composition (children, slots) over configuration flags.
- Use compound components for related, coordinated parts.
- Share state via context, not prop drilling.
- Expose render props or slots for true customization.
- Keep the default usage simple; advanced control opt-in.
Patterns:
- compound components for grouped UI (Tabs, Tabs.List, Tabs.Tab)
- context to coordinate without prop drilling
- render props / slots for caller-controlled rendering
- polymorphic
asprop where appropriate
Rules:
- favor children over a growing prop list
- do not leak internal structure through booleans
- keep each part single-purpose and replaceable
- common case stays trivial; complexity is opt-in