0Pricing
React Academy · Lesson

Slots Pattern with Clearly Named Children

Implement slot-like APIs with named props or child parts (Header, Actions, Footer). Provide defaults and keep placement predictable.

Slots overview

Goal: Give users places to insert UI.

  • Named props: header, actions, footer
  • Child parts: Card.Header, Card.Body, Card.Footer
  • Defaults for missing slots

Design rules for slots

  • Clear names reflect layout areas
  • Predictable placement inside parent
  • Fallbacks if a slot is not provided

All lessons in this course

  1. Parent–Child Coordination via Context
  2. API Ergonomics with Composition
  3. Slots Pattern with Clearly Named Children
← Back to React Academy