On this page

Tabs

Install, props and the parts Tabs is built from.

Install

Run this in the app, after shadcn-vue init and the Beehexa theme (Button › Code):

npx shadcn-vue@latest add https://beehexa.design/r/tabs.json

Use

<script setup lang="ts">
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
</script>

<template>
  <Tabs default-value="overview">
    <TabsList aria-label="Online store connection">
      <TabsTrigger value="overview">Overview</TabsTrigger>
      <TabsTrigger value="mappings">Mappings</TabsTrigger>
    </TabsList>
    <TabsContent value="overview">…</TabsContent>
    <TabsContent value="mappings">…</TabsContent>
  </Tabs>
</template>

Props

Part Prop Values Notes
Tabs defaultValue, v-model string The selected tab
Tabs orientation horizontal (default), vertical Vertical puts the bar on the edge next to the panel
Tabs activationMode automatic (default), manual Manual: arrow keys move focus, Enter or Space selects. Use it when a panel is slow to load
TabsList variant default, line default draws a line under the list; line leaves it out, for a list that already sits on an edge
TabsList aria-label string Name the list when the page has more than one
TabsTrigger value string Matches a TabsContent
TabsTrigger disabled boolean
TabsContent value string
TabsContent forceMount boolean Keep a panel in the page while hidden

Built on

Wraps the reka-ui Tabs with the shadcn-vue Tabs API, from control-center’s copy. reka-ui gives the roles, aria-selected, aria-controls and the arrow keys. Beehexa adds the styles, the selected fill and bar, and a focus ring on the panel.

Differences from shadcn-vue

  • Both TabsList variants are line tabs. The shadcn-vue default look, a grey track with a raised tab, is what the segmented control is for.
  • The list spans the full width and tabs keep their own width (shadcn-vue stretches them).
  • The selected tab is marked with aria-selected styles, not data-active, so hover never hides the selected fill.

Limitations

  • The bar does not slide between tabs yet (motion.indicator); it moves at once.