Skip to content

Search documentation

Search guides, examples, and component APIs.

Quick links
↑↓ NavigateEnter OpenEsc Close
Get started

Documentation navigation

Components / Navigation

Tabs

Switch related views while keeping each panel mounted.

Last changed in version 0.14.2: Improve keyboard navigation, action feedback, and selected colors across Vue components.

Interactive showcase

Install

Run in your project
bunx --bun @getweini/cli@latest add tabs

Start with this example

Import the files copied by the install command, then place the component in your Vue template. The text and values in the example belong to your app; change them to fit your task.

Overview content
Vue
<script setup lang="ts">
import { ref } from 'vue'
import Tabs from './components/ui/tabs/Tabs.vue'
import TabsContent from './components/ui/tabs/TabsContent.vue'
import TabsList from './components/ui/tabs/TabsList.vue'
import TabsTrigger from './components/ui/tabs/TabsTrigger.vue'

const view = ref('overview')
</script>

<template>
  <Tabs v-model="view" label="Workspace views">
    <TabsList>
      <TabsTrigger value="overview">
        <template #icon>
          <svg aria-hidden="true" viewBox="0 0 16 16">
            <path d="M2 2h5v5H2zm7 0h5v5H9zM2 9h5v5H2zm7 0h5v5H9z" fill="currentColor" />
          </svg>
        </template>
        Overview
      </TabsTrigger>
      <TabsTrigger value="activity">Activity</TabsTrigger>
    </TabsList>
    <TabsContent value="overview">Overview content</TabsContent>
    <TabsContent value="activity">Activity content</TabsContent>
  </Tabs>
</template>

Arrow keys move between tabs. Manual activation selects with Enter or Space.

When to use it

Related views

Switch between a project overview, activity, and team information in one place.

Expensive panels

Use manual activation when changing a tab starts costly work.

More examples

Project views

Connect each trigger value to exactly one panel.

Project views
<script setup lang="ts">
import { ref } from 'vue'
import Tabs from './components/ui/tabs/Tabs.vue'
import TabsContent from './components/ui/tabs/TabsContent.vue'
import TabsList from './components/ui/tabs/TabsList.vue'
import TabsTrigger from './components/ui/tabs/TabsTrigger.vue'

const view = ref('overview')
</script>

<template>
  <Tabs v-model="view" label="Project views">
    <TabsList>
      <TabsTrigger value="overview">Overview</TabsTrigger>
      <TabsTrigger value="activity">Activity</TabsTrigger>
    </TabsList>
    <TabsContent value="overview"><p>Project summary</p></TabsContent>
    <TabsContent value="activity"><p>Recent changes</p></TabsContent>
  </Tabs>
</template>

Manual activation

Arrow keys move focus; Enter or Space selects the focused tab.

Manual activation
<script setup lang="ts">
import Tabs from './components/ui/tabs/Tabs.vue'
import TabsContent from './components/ui/tabs/TabsContent.vue'
import TabsList from './components/ui/tabs/TabsList.vue'
import TabsTrigger from './components/ui/tabs/TabsTrigger.vue'
</script>

<template>
  <Tabs label="Report views" activation="manual" orientation="vertical">
    <TabsList>
      <TabsTrigger value="chart">Chart</TabsTrigger>
      <TabsTrigger value="data">Data</TabsTrigger>
    </TabsList>
    <TabsContent value="chart">Chart preview</TabsContent>
    <TabsContent value="data">Data summary</TabsContent>
  </Tabs>
</template>

Complete API

Every public prop, model, event, slot, and exposed member of the installed Vue parts is listed below. “Not set” means you can leave that value out; “Required” means you must provide it. Native HTML attributes also work where the component uses a native element.

Tabs

Complete API for Tabs
NameType or signatureDefaultWhat it does
itemspropreadonly TabItem[] | undefinedNot setData items displayed by this component.
labelpropstring | undefinedNot setVisible or accessible name for this item.
orientationprop"horizontal" | "vertical" | undefined"horizontal"Arrange items horizontally or vertically.
activationprop"automatic" | "manual" | undefined"automatic"Choose how the action is activated.
modelValuemodelstring | undefinedNot setCurrent value. Use v-model to keep it in sync with your page.
update:modelValueevent[value: string | undefined]—Requests a new model value from the parent.
triggerslot{ item: TabItem; active: boolean; }OptionalContent for the trigger area of Tabs.
defaultslot{ item: TabItem; active: boolean; }OptionalContent shown inside Tabs.

TabsContent

Complete API for TabsContent
NameType or signatureDefaultWhat it does
valuepropstringRequiredValue represented by this control or option.
defaultslot{}OptionalContent shown inside TabsContent.

TabsList

Complete API for TabsList
NameType or signatureDefaultWhat it does
defaultslot{}OptionalContent shown inside TabsList.

TabsTrigger

Complete API for TabsTrigger
NameType or signatureDefaultWhat it does
valuepropstringRequiredValue represented by this control or option.
disabledpropboolean | undefinedNot setPrevent interaction and show the disabled state.
defaultslot() => unknownRequiredContent shown inside TabsTrigger.
iconslot(() => unknown) | undefinedOptionalContent for the icon area of TabsTrigger.
Public type definitions
Public types
// packages/frameworks/vue/components/tabs/types.ts
// ------- TYPES -------

export interface TabItem {
  value: string
  label: string
  disabled?: boolean
}

export interface TabsProps {
  items?: readonly TabItem[]
  label?: string
  orientation?: 'horizontal' | 'vertical'
  activation?: 'automatic' | 'manual'
}

Implementation notes

  • Use tabs for peer views of the same subject; use navigation links for separate pages.
  • Keep trigger values unique and paired with matching content values.

Accessibility and localization

  • The label names the tab set; arrow keys move focus and manual activation requires Enter or Space.

Source contract and editing guidance