children prop
The special React prop holding whatever is placed between a component's opening and closing tags.
In more detail
<Card><CardTitle /></Card> passes the CardTitle element as Card's children. Accepting children lets consumers decide the content and order, which is the simplest form of composition.
Examples
<Modal><OrderList /></Modal> // OrderList stays a Server Component<Card title="News"><p>Body text</p></Card>Related terms
- composition — Building a component out of smaller components that the consumer assembles, instead of configuring one big component with flags.
- prop — An input passed to a React component, written like an HTML attribute, such as size="lg" in <Button size="lg">.
- slot — A place in a component's layout that the consumer fills with their own content, either through a named prop such as icon or through a Slot component.
- composition — Building bigger components by combining smaller ones, often by passing elements in as children or other props.
- props — The inputs passed to a component, written like HTML attributes, such as <Avatar size={48} />.
- layout.tsx — The special file that wraps a segment and all its children in shared UI that stays mounted while you navigate between them.
- ReactNode — The TypeScript type for anything React can render: elements, strings, numbers, arrays of these, null, undefined or booleans.
Taught in
- Component API Ergonomics: Composition vs Boolean Config Props — Design Systems & Component Engineering
- Polymorphism & Slotted Composition: The asChild Pattern — Design Systems & Component Engineering
- Component Tree Composition: Interleaving RSC & Client — Next.js 15 & Modern App Router Architecture
- Props Contract: Immutability, Children, And Polymorphic Tags — React 19 & Modern Component Architecture
- Lifting State Up: Colocation, Ownership, And Data Flow — React 19 & Modern Component Architecture
- Slot Patterns And Headless UI Architecture in React — React 19 & Modern Component Architecture
- Error Boundaries: componentDidCatch And Fallback UI Trees — React 19 & Modern Component Architecture