Tabs
One surface, several mutually exclusive panels.
Specimen
Only the selected panel is exposed.
Panels hide with `hidden`, not CSS.
The tablist scrolls sideways on a phone.
Props
| Prop | Type | Note |
|---|---|---|
| label | string | Required. Names the tablist for screen readers. |
| items | { id, label, panel }[] | Order is the tab order. |
Use it for
- Several mutually exclusive views of one subject, where only one matters at a time.
- The moving-indicator pattern generalises, and is now shared code: useIndicator measures whichever child matches a selector and publishes --indicator-x/w to the container. Tabs points it at [aria-selected="true"], the top navigation at [aria-current="page"].
- A set with nothing selected shows no mark: the hook writes data-indicator="off" on the container, which is also what suppresses the travel on first paint.
Do not use it for
- Hiding content a reader needs to compare — put it side by side instead.
- More than about five tabs; past that it is navigation.