Compound Components
Learn how compound components share implicit state between a parent and its children via context, giving a flexible, declarative API.
The compound components pattern lets a group of components work together to form a cohesive unit, similar to how HTML's <select> and <option> implicitly cooperate, while giving consumers flexibility in how they arrange and configure the children. A parent component (like Tabs) manages shared state internally and exposes it to its children (Tabs.List, Tabs.Panel) via Context, rather than requiring the consumer to manually wire props between siblings.
Compound components are like a table place setting: the plate, fork, and glass (sub-components) are separate physical pieces you can arrange as you like on the table, but they're all implicitly coordinated as part of 'one place setting' (the parent's shared context) rather than each being wired together by hand every time you set the table.