Problem
Build a reusable Tabs component.
Requirements
- Render a list of tab headers and show the active tab's panel only.
- Clicking a header activates that tab.
- (Bonus) Keyboard navigation (arrow keys) and ARIA roles (
tablist,tab,tabpanel,aria-selected). - (Bonus) Lazy-mount panel content; controlled vs uncontrolled active tab.
Hints / Approach
- Keep
activeIndexin state; rendertabs[activeIndex].content. - Data-driven API:
<Tabs items={[{ label, content }]} />. - For accessibility, link each tab to its panel with
aria-controls/idand manage focus withtabIndex.