# Tabs

> A tablist compound with roving-tabindex keyboard navigation, automatic or manual activation, and an accent-underline or segmented visual style.

- Package: `fancy-ui-vue` (Vue 3.5+ + Tailwind CSS v4)
- Category: Navigation
- Tags: tabs, tablist, roving-tabindex, compound, navigation
- Types: `TabsProps`, `TabsListProps`, `TabsTriggerProps`, `TabsContentProps`, `TabsContext`
- Docs: https://fancy-ui.rama.app/docs/components/tabs
- Source: https://github.com/RamaHerbin/fancy-ui/tree/main/vue/src/components/tabs

## Import

```vue
<script setup lang="ts">
import { Tabs } from 'fancy-ui-vue';
</script>
```

Setup (once per project): `npm install fancy-ui-vue`, then put these lines in your main CSS file (the stylesheet imports go right after `@import "tailwindcss";`):

```css
@import "tailwindcss";
@import "fancy-ui-vue/tailwind.css";
@import "fancy-ui-vue/styles.css";
```

Full guide: https://fancy-ui.rama.app/llms.txt

The names below are the ones to write in a Vue template; when one differs from the Svelte name, the Svelte name follows in parentheses. Snippets become named slots (`#default` is the default snippet), a prop the Vue port declares as a model is a `v-model:<name>` (except `ref`, exposed via `defineExpose({ ref })`: put a template ref on the component and read `.ref`) and callbacks are listeners (`onclick` is `@click`). Every component sets `inheritAttrs: false`: `class` is a declared prop, merged where the Svelte component applies it (not always the root element), and only when the props table below lists it; other attributes do not fall through unless the package README lists the component as forwarding native attributes. Divergences: https://github.com/RamaHerbin/fancy-ui/tree/main/vue#divergences-from-the-svelte-api

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `v-model:value` (Svelte `value`) | `string` | `""` | The active tab's value, bindable. |
| `@value-change` (Svelte `onValueChange`) | `(value: string) => void` | — | Called with the new value whenever the active tab changes. |
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | The tablist's stacking axis and which arrow-key pair moves it. |
| `activation` | `"automatic" \| "manual"` | `"automatic"` | Whether arrowing to a trigger selects it immediately, or only moves focus. |
| `variant` | `"underline" \| "segmented"` | `"underline"` | Accent underline, or a segmented pill rail. |
| `class` | `string` | — | Additional CSS classes, merged onto the root. |
| `ref` | `HTMLDivElement \| null` | `null` | Bindable reference to the root element. |
| `sound` | `boolean` | `false` | Plays select when the active tab actually changes, once the user has enabled sound |
| `TabsList.class` | `string` | — | Additional CSS classes, merged onto the tablist. |
| `TabsList.ref` | `HTMLDivElement \| null` | `null` | Bindable reference to the tablist element. |
| `TabsTrigger.value` (required) | `string` | — | This trigger's value — which TabsContent it activates. |
| `TabsTrigger.disabled` | `boolean` | `false` | Disables just this trigger; it is skipped by the arrows and Home/End. |
| `TabsTrigger.class` | `string` | — | Additional CSS classes, merged onto the trigger button. |
| `TabsTrigger.ref` | `HTMLButtonElement \| null` | `null` | Bindable reference to the trigger's button element. |
| `TabsContent.value` (required) | `string` | — | Which TabsTrigger shows this panel. |
| `TabsContent.forceMount` | `boolean` | `false` | Keeps this panel mounted (with hidden) even while inactive, instead of unmounting it entirely. |
| `TabsContent.class` | `string` | — | Additional CSS classes, merged onto the panel. |
| `TabsContent.ref` | `HTMLDivElement \| null` | `null` | Bindable reference to the panel element. |

## Slots

| Slot | Description |
| --- | --- |
| `#default` (Svelte `children`) | A TabsList and one or more TabsContents. |
| `TabsList.#default` (Svelte `TabsList.children`) | The TabsTriggers. |
| `TabsTrigger.#default` (Svelte `TabsTrigger.children`) | The trigger's content, typically the tab's label. |
| `TabsContent.#default` (Svelte `TabsContent.children`) | The panel's content. |

## Example

```vue
<script setup lang="ts">
import { ref } from "vue";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "fancy-ui-vue";

const section = ref("account");
</script>

<template>
	<Tabs v-model:value="section" sound>
		<TabsList>
			<TabsTrigger value="account">Account</TabsTrigger>
			<TabsTrigger value="security">Security</TabsTrigger>
			<TabsTrigger value="billing">Billing</TabsTrigger>
		</TabsList>
		<TabsContent value="account">Manage your profile, name, and avatar.</TabsContent>
		<TabsContent value="security">Update your password and two-factor settings.</TabsContent>
		<TabsContent value="billing">View invoices and update your payment method.</TabsContent>
	</Tabs>
</template>
```
