Tabs
Switches between sibling panels without leaving the page.
mq-tabs is a compound primitive: a wrapper, a list of triggers, and one panel
per trigger. It ships from @mediquo/ui as custom elements and as React
components.
Install
// Custom elements — the import registers <mq-tabs> and friends
import "@mediquo/ui/components/tabs";// React
import {
Tabs,
TabsContent,
TabsList,
TabsTrigger,
} from "@mediquo/ui/react/tabs";Accessibility
- The wrapper wires
aria-controlsandaria-labelledbybetween each trigger and its panel, generating ids where they are missing. labelon the list is its accessible name;orientationis reflected asaria-orientation.- Only the selected trigger is in the tab order — arrows move between triggers,
HomeandEndjump to the ends, and disabled triggers are skipped. activationMode="manual"separates moving focus from selecting, which is the right choice when revealing a panel is expensive.
Behaviour worth knowing
- A trigger whose
valuematches no panel controls nothing, so the component warns about it in the console rather than failing silently. - With no
valueordefaultValue, the first trigger wins.