Skip to content

Tabs ​

Switch between views of the same subject in place: a project's overview, activity and settings. Use page navigation for separate pages, and radio-group to set a value.

Usage ​

vue
<Tabs v-model="tab">
  <TabsList aria-label="Project">
    <TabsTrigger value="overview">Overview</TabsTrigger>
    <TabsTrigger value="activity">Activity</TabsTrigger>
  </TabsList>
  <TabsContent value="overview">…</TabsContent>
  <TabsContent value="activity">…</TabsContent>
</Tabs>

Props ​

PartPropTypeDefaultNotes
TabsmodelValuestringnonev-model; the active tab's value
TabsdefaultValuestringnoneThe tab active at first, without v-model
Tabsvariant'line' | 'pill''line'Applies to the list and every trigger
Tabsorientation'vertical' | 'horizontal''horizontal'Layout and arrow keys
Tabsdir'ltr' | 'rtl'noneLayout and arrow keys together; by default both follow the page
TabsTriggervaluestringnoneRequired
TabsTriggerdisabledbooleanfalse
TabsContentvaluestringnoneRequired; the trigger it belongs to

Every part takes class, merged last. Name the list with aria-label (or aria-labelledby).

Tabs follow the page's direction, in layout and arrow keys; dir sets another for one tab set. Vertical tabs stack above their panels below the sm breakpoint, and line tabs that wrap keep their rule on every row.

Slots ​

PartSlotContent
TabsdefaultThe list and the panels
TabsListdefaultThe triggers
TabsTriggerdefaultThe tab's name
TabsContentdefaultThe panel

Events ​

PartEventPayloadWhen
Tabsupdate:modelValuestring | undefinedAnother tab becomes active

Tokens ​

None of their own. line underlines the active tab in primary on a border rule; pill sets it as a background chip on a muted track.

States ​

each variant, horizontal and vertical; active, inactive, hover, focus-visible, disabled trigger; many tabs that wrap.

Keyboard ​

KeyAction
TabInto the list on the active tab, then into the active panel
ArrowRight, ArrowLeftNext, previous tab (horizontal), wrapping; activates it
ArrowDown, ArrowUpNext, previous tab (vertical), wrapping; activates it
Home, EndFirst, last tab

Accessibility ​

  • TabsList is role="tablist" with aria-orientation; triggers are role="tab" with aria-selected and aria-controls; panels are role="tabpanel", labelled by their trigger.
  • A panel without focusable content takes focus itself (tabindex="0"), so keyboard users reach it.

Do ​

vue
<TabsList aria-label="Invoice">
  <TabsTrigger value="details">Details</TabsTrigger>
  <TabsTrigger value="history">History</TabsTrigger>
</TabsList>

Do not ​

vue
<!-- Tabs as site navigation: use links, so each page has its own URL. -->
<TabsTrigger value="/billing" @click="router.push('/billing')">Billing</TabsTrigger>