Skip to content

Tabs

Tabs, Tab, and TabPanel work together to create an accessible tabbed interface. Tabs manages state and provides context; Tab renders the clickable button; TabPanel renders the matching content panel.

Basic

Tailwind v4
vue
<Tabs>
  <template #tabs>
    <Tab id="overview">Overview</Tab>
    <Tab id="details">Details</Tab>
    <Tab id="history">History</Tab>
  </template>
  <TabPanel id="overview">Overview content</TabPanel>
  <TabPanel id="details">Details content</TabPanel>
  <TabPanel id="history">History content</TabPanel>
</Tabs>

Default variant

Tailwind v4
vue
<Tabs variant="default">
  <template #tabs>
    <Tab id="production">Production</Tab>
    <Tab id="equipment">Equipment</Tab>
    <Tab id="reports">Reports</Tab>
  </template>
  <TabPanel id="production">Production panel content.</TabPanel>
  <TabPanel id="equipment">Equipment panel content.</TabPanel>
  <TabPanel id="reports">Reports panel content.</TabPanel>
</Tabs>

Disabled tab

Tailwind v4
vue
<Tabs>
  <template #tabs>
    <Tab id="active-tab">Active</Tab>
    <Tab id="disabled-tab" :disabled="true">Disabled</Tab>
    <Tab id="another-tab">Another</Tab>
  </template>
  <TabPanel id="active-tab">Active content</TabPanel>
  <TabPanel id="disabled-tab">Unreachable content</TabPanel>
  <TabPanel id="another-tab">Another tab's content</TabPanel>
</Tabs>

Controlled (v-model)

Active:
Tailwind v4
vue
<script setup>
import { ref } from 'vue'
const activeTab = ref('tab-a')
</script>

<Tabs v-model="activeTab">
  <template #tabs>
    <Tab id="tab-a">Tab A</Tab>
    <Tab id="tab-b">Tab B</Tab>
  </template>
  <TabPanel id="tab-a">Tab A panel.</TabPanel>
  <TabPanel id="tab-b">Tab B panel.</TabPanel>
</Tabs>

Props

Tabs

PropTypeDefaultDescription
modelValuestringActive tab id (controlled mode via v-model)
variant'underlined' | 'default''underlined'Visual style of the tab bar

Tab

PropTypeDefaultDescription
idstringRequired. Unique identifier; must match the corresponding TabPanel id
disabledbooleanfalsePrevents the tab from being selected

TabPanel

PropTypeDefaultDescription
idstringRequired. Must match the corresponding Tab id

Slots

Tabs

SlotDescription
tabsRenders inside the tab bar (role="tablist"). Place Tab components here
defaultRenders inside the content area. Place TabPanel components here

Tab

SlotDescription
defaultTab label text

TabPanel

SlotDescription
defaultPanel content (kept mounted but hidden when not active)

Private — Jetpack Labs internal use only