Tabs
Switch between related panels within a single view, keeping one panel visible at a time.
Purpose
Tabs suit peer views of the same subject. If the panels are steps in a sequence, use Stepper; if they are independent optional detail, use Accordion.
Example
Outpatient, dental and optical cover, with a combined annual limit of MYR 3,000.
Variants
TabsList ships two styles: segmented (the default) — a pill track with the active tab elevated —
and underline — flat tabs with an active underline, used for icon + label tabs.
Four claims submitted this year, of which three have been approved.
States
A trigger can be disabled — it renders at 50% opacity with pointer events off, and keyboard navigation skips it.
Dependants is disabled here — no dependants are enrolled on this plan.
Structure
The tokens behind both variants.
| Property | Value |
|---|---|
| List height | 40px (h-10), both variants |
| Typography | 14px / Inter 600 (text-sm font-semibold) |
| Segmented track | --muted fill, --radius-md corners, 4px padding, 4px gap |
| Segmented active | --background fill, --foreground text, --shadow-1 |
| Underline track | 1px --border bottom rule, 16px gap |
| Underline active | 2px --primary underline, --foreground text |
| Icons | 1.2em Material Symbols, sized from the label |
| Panel offset | 12px above the content (mt-3) |
| Focus | 2px --ring |
| Disabled trigger | 50% opacity, pointer events off |
Best practices
Do
- Keep tab labels short and parallel — one or two words naming the panel's subject.
- Use
underlinewith icon + label pairs; keepsegmentedfor compact text-only switches. - Put the most useful panel first and make it the
defaultValue. - Keep every panel's content peer-level views of the same subject.
Don't
- Use tabs for steps in a sequence — that is Stepper's job.
- Nest tabs inside tabs — restructure the page instead.
- Hide the primary action of the view inside a non-default tab.
- Disable a trigger without making the reason visible nearby.
Accessibility & keyboard
- Radix renders full tablist semantics: triggers are
role="tab"carryingaria-selected, and each panel isrole="tabpanel"linked to its trigger. - The selected tab is announced, and its panel is associated with it.
- Disabled triggers are skipped by keyboard navigation and removed from the tab order.
- Focus shows a 2px
--ringoutline on triggers and panels — never remove it. - Keyboard: arrow keys move between tabs and select as they go; Home / End jump to the first and last tab; Tab moves into the active panel.
Props
The parts are styled Radix Tabs primitives and accept every Radix prop — defaultValue /
value / onValueChange on Tabs, disabled on TabsTrigger. The one addition is variant
on TabsList: "segmented" (default) or "underline".