Components

Tabs

A set of layered sections of content, one visible at a time.

A tab list with associated panels. Follows the WAI-ARIA Tabs pattern with roving tabindex, keyboard arrow navigation, and an animated sliding indicator.

Anatomy

  • #tab — content rendered inside each tab button (defaults to the item's label)
  • #panel-{value} — the content panel for each tab (named by the item's value)

The tab button itself is rendered by the component; use the ui.tab prop to add classes to it. The tab list also renders an akaza-tab-indicator span that you can style for a sliding underline or pill effect.

Usage

Account settings

Manage your name, email, and profile picture.

Examples

Custom tab button

Use #tab to style each tab button and react to the active state.

<template>
  <Tabs :items="tabs" v-model="active">
    <template #tab="{ item, isActive }">
      <span :class="['tab', { 'tab--active': isActive }]">
        {{ item.label }}
      </span>
    </template>

    <template #panel-account>Account content.</template>
    <template #panel-security>Security content.</template>
  </Tabs>
</template>

Pill-style tabs

Apply background styles to the tab list and use the indicator for a sliding pill.

<template>
  <Tabs
    :items="tabs"
    v-model="active"
    :ui="{ list: 'tabs-pill-list', indicator: 'tabs-pill-indicator' }"
  >
    <template #panel-account>Account content.</template>
    <template #panel-security>Security content.</template>
  </Tabs>
</template>

Manual activation mode

Arrow keys only move focus; the user must press Space or Enter to activate a tab.

<template>
  <Tabs :items="tabs" v-model="active" activation-mode="manual">
    <template #panel-account>Account content.</template>
  </Tabs>
</template>

Vertical orientation

<template>
  <Tabs :items="tabs" v-model="active" orientation="vertical">
    <template #panel-account>Account content.</template>
  </Tabs>
</template>

Unmount inactive panels

Remove inactive panels from the DOM instead of hiding them.

<template>
  <Tabs :items="tabs" v-model="active" :unmount-on-hide="true">
    <template #panel-account>Account content.</template>
  </Tabs>
</template>

API Reference

Props

PropTypeDefaultDescription
itemsTabsItem[]Required. List of tab items.
modelValuestring""Currently active tab value.
orientation"horizontal" | "vertical""horizontal"Tab list direction.
activationMode"automatic" | "manual""automatic"automatic: arrow keys activate. manual: arrow keys move focus only.
unmountOnHidebooleanfalseUse v-if instead of v-show for inactive panels.
ariaLabelstringaria-label for the tab list.
labelKeystring"label"Property to use as label when items are objects.
uiTabsUiCSS class overrides.

TabsItem

KeyTypeDescription
valuestringRequired. Unique identifier and panel slot suffix.
labelstringDisplay label (used by the default #tab slot).
disabledbooleanDisables this tab.

Slots

SlotScoped propsDescription
tab{ item, isActive, select }Each tab button. Defaults to rendering the item's label.
panel-{value}{ item, isActive }Content panel for the tab with the matching value.

UI Options

KeyDescription
rootThe outer wrapper element.
listThe tab list element.
tabEach tab button element.
indicatorThe sliding indicator span.
panelsThe panels wrapper element.
panelEach panel element.