Skip to content

Tabs

Switch between sections of content.

Demos

Size
Variant

Usage

vue
<script setup lang="ts">
import { Accordion } from '~/components/ui/accordion'

const items = [
  { value: 'source', label: 'Do I own the source?', content: 'Yes. Copy and adapt the files.' },
]
</script>

<template>
  <Accordion :items="items" />
</template>

The default soft variant uses inset segmented pills with a sliding selection background. Items and the indicator follow the control radius for the selected size; the container adds 4px to that radius. At sm, the inner radius is 6px and the outer radius is 10px. The surface stays flat, without a resting shadow. The line variant uses a sliding underline. Both respect reduced-motion preferences.

Panels share one grid area by default, reserving room for the tallest retained panel and switching content with a 60ms fade-out followed by a 140ms, 4px slide-fade. Only one panel is painted at a time, so text does not overlap during the transition. Inactive panels stay hidden from interaction. If you enable unmountOnHide, use ui.panels to reserve any minimum height your layout needs.

Installation

Complete the shared installation. Copy Tabs.vue and index.ts into app/components/ui/tabs/.

API

Variants and defaults

PropValuesDefault
sizexs, sm, md, lg, xlsm
variantsoft, linesoft

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.
ariaLabelstringโ€”aria-label for the tab list.
labelKeystring"label"Property to use as label when items are objects.
uiTabsUiโ€”CSS class overrides.

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.

Events

EventPayloadDescription
value-change[value: string, details]Fired when selected tab changes.

Keyboard

KeyBehavior
ArrowLeft / ArrowRightMoves through enabled horizontal tabs and loops.
ArrowUp / ArrowDownMoves through enabled vertical tabs and loops.
Home / EndFocuses first or last enabled tab.
Enter / SpaceActivates focused tab. Required in manual activation mode.
TabMoves from active tab into active panel or next focusable control.

Automatic mode activates during arrow movement. Manual mode moves focus only until activation.