Tabs
Switch between views of the same thing. Underline tabs navigate; a segmented switcher filters in place.
Quick usage
Import the shared component; never copy its markup into a feature. The Web TSX tab beside the live stage has a complete, working example.
import UnderlineTabs from '@/shared/components/Tabs';Live stage and code
The live component and its controls on the left, the code on the right; change a control and the code follows: Web TSX (the component in a working example), Tailwind and HTML (the markup it renders, with its data attributes), React Native, SwiftUI and Jetpack Compose. The header theme switch drives every stage.
Props
Read from the component's source when the docs build: names and defaults from its signature, types and descriptions from its JSDoc. A blank type means the prop has no JSDoc yet.
| Prop | Type | Default | Description |
|---|---|---|---|
items | - | - | - |
value | - | - | - |
onChange | - | - | - |
size | - | 'large' | - |
ariaLabel | - | - | - |
className | - | - | - |
Source: frontend/src/shared/components/Tabs/UnderlineTabs.tsx
DOM contract
What the rendered element carries: the data attributes its styles key on, its roles and ARIA, its focus style, and whether its stylesheet draws the 44px hit boundary. Also read from the source.
| Data attributes | None set by the component |
| Roles | role="tab"role="tablist" |
| ARIA | aria-labelaria-selected |
| Focus | Styles :focus-visible in its own stylesheet |
| 44px hit boundary | Yes: a ::after in UnderlineTabs.module.css |
Accessibility and touch
Each tab is a 32 or 36px target.
Visible height 28px. The ::after boundary adds 8px above and below, so a gloved finger lands on a 44px target while the row keeps its density.
Rules and constraints
Use it for
- Page sections (underline), view ranges such as Day / Week (segmented).
Avoid
- Never a segmented switcher for navigation, never underline tabs for a filter.
Constraints
- Underline: flush, the active tab marked by a 2px inset terracotta line.