pnpm add @ghostvue/themesnpm install @ghostvue/themesyarn add @ghostvue/themesGhostTabs implements the WAI-ARIA APG tabs pattern with list, trigger, and content parts. Import the compound pieces from @ghostvue/vue for headless use, or from @ghostvue/themes for the default tab strip and panel surfaces.
Workspace overview, members, and activity panels with a disabled tab, counts, long labels, and a right-to-left layout switch.
Plan, people, and recent changes for the design systems team.
Team plan, renewed every November.
People who can open this workspace.
The latest changes, newest first.
Only workspace owners can see billing.
<script setup lang="ts">
import { computed, ref } from 'vue'
import {
GhostAvatar,
GhostBadge,
GhostSegmentedControl,
GhostSegmentedControlItem,
GhostTabs,
GhostTabsContent,
GhostTabsList,
GhostTabsTrigger,
} from '@ghostvue/themes'
type Layout = 'short' | 'long' | 'rtl'
type Role = 'owner' | 'admin' | 'editor' | 'viewer'
interface TabLabels {
overview: string
members: string
activity: string
billing: string
}
/*
* Deterministic local copy, all in English. The layout switch stresses the
* strip without translations: "Long" uses wordy tab names so the
* strip wraps, and "RTL" sets `dir="rtl"` on the example, where
* ArrowLeft moves to the next tab. Names, emails, and dates stay fixed so
* screenshots and tests never depend on the clock or the network.
*/
const shortTabs: TabLabels = {
overview: 'Overview',
members: 'Members',
activity: 'Activity',
billing: 'Billing',
}
const layouts: Record<Layout, { dir: 'ltr' | 'rtl'; tabs: TabLabels }> = {
short: { dir: 'ltr', tabs: shortTabs },
long: {
dir: 'ltr',
tabs: {
overview: 'Overview and plan',
members: 'Members and permissions',
activity: 'Activity log',
billing: 'Billing and invoices',
},
},
rtl: { dir: 'rtl', tabs: shortTabs },
}
const stats: readonly { label: string; value: string }[] = [
{ label: 'Members', value: '4 of 10 seats' },
{ label: 'Projects', value: '14 active' },
{ label: 'Storage', value: '18.4 GB of 50 GB' },
]
const roles: Record<Role, string> = {
owner: 'Owner',
admin: 'Admin',
editor: 'Editor',
viewer: 'Viewer',
}
const events: readonly { text: string; date: string }[] = [
{ text: 'Ada Lovelace published Tokens v4.2', date: '2026-11-18' },
{ text: 'Grace Hopper invited Alan Turing', date: '2026-11-17' },
{ text: 'Katherine Johnson archived Legacy icons', date: '2026-11-14' },
]
const members: readonly { name: string; email: string; role: Role }[] = [
{ name: 'Ada Lovelace', email: 'ada@northwind.example', role: 'owner' },
{ name: 'Grace Hopper', email: 'grace@northwind.example', role: 'admin' },
{
name: 'Katherine Johnson',
email: 'katherine.johnson@northwind.example',
role: 'editor',
},
{ name: 'Alan Turing', email: 'alan@northwind.example', role: 'viewer' },
]
const layout = ref<Layout>('short')
const section = ref('overview')
const current = computed(() => layouts[layout.value])
function isLayout(value: string | undefined): value is Layout {
return value === 'short' || value === 'long' || value === 'rtl'
}
function setLayout(value: string | undefined): void {
if (isLayout(value)) layout.value = value
}
</script>
<template>
<!--
`dir` sits on the example root so the strip, the panels, and the tab
list's roving focus all follow the chosen layout.
-->
<section
class="workspace"
:dir="current.dir"
:data-layout="layout"
aria-labelledby="workspace-title"
>
<header class="workspace__header">
<div class="workspace__heading">
<h2 id="workspace-title" class="workspace__title">
Northwind design workspace
</h2>
<!--
<bdi> keeps English sentences intact in the right-to-left layout:
without it, the closing period and leading numbers jump to the
wrong edge. Wrap mixed-direction text the same way in your app.
-->
<p class="workspace__lead">
<bdi
>Plan, people, and recent changes for the design systems team.</bdi
>
</p>
</div>
<GhostSegmentedControl
:model-value="layout"
aria-label="Tab layout"
class="workspace__layout"
@update:model-value="setLayout"
>
<GhostSegmentedControlItem value="short">
Short
</GhostSegmentedControlItem>
<GhostSegmentedControlItem value="long">
Long
</GhostSegmentedControlItem>
<GhostSegmentedControlItem value="rtl"> RTL </GhostSegmentedControlItem>
</GhostSegmentedControl>
</header>
<GhostTabs v-model="section">
<!--
GhostTabs renders no element. This grid is the explicit stack: the
strip always sits above the panel, and the themed panel's own top
margin is the only gap between them.
-->
<div class="workspace__tabs">
<GhostTabsList aria-label="Workspace sections" class="workspace__strip">
<GhostTabsTrigger value="overview" class="workspace__tab">
{{ current.tabs.overview }}
</GhostTabsTrigger>
<GhostTabsTrigger value="members" class="workspace__tab">
{{ current.tabs.members }}
<span class="workspace__count">{{ members.length }}</span>
</GhostTabsTrigger>
<GhostTabsTrigger value="activity" class="workspace__tab">
{{ current.tabs.activity }}
</GhostTabsTrigger>
<!-- Disabled tabs stay visible but are skipped by arrow keys. -->
<GhostTabsTrigger value="billing" class="workspace__tab" disabled>
{{ current.tabs.billing }}
</GhostTabsTrigger>
</GhostTabsList>
<GhostTabsContent value="overview" class="workspace__panel">
<p class="workspace__intro">
<bdi>Team plan, renewed every November.</bdi>
</p>
<dl class="workspace__stats">
<div
v-for="stat in stats"
:key="stat.label"
class="workspace__stat"
>
<dt class="workspace__stat-label">{{ stat.label }}</dt>
<dd class="workspace__stat-value">
<bdi>{{ stat.value }}</bdi>
</dd>
</div>
</dl>
</GhostTabsContent>
<GhostTabsContent value="members" class="workspace__panel">
<p class="workspace__intro">
<bdi>People who can open this workspace.</bdi>
</p>
<ul class="workspace__list">
<li
v-for="member in members"
:key="member.email"
class="workspace__member"
>
<GhostAvatar :name="member.name" size="sm" />
<span class="workspace__person">
<span class="workspace__name">{{ member.name }}</span>
<!-- Emails are left-to-right text even inside a right-to-left layout. -->
<span class="workspace__meta" dir="ltr">{{
member.email
}}</span>
</span>
<GhostBadge
:tone="member.role === 'owner' ? 'accent' : 'neutral'"
:variant="member.role === 'owner' ? 'soft' : 'outline'"
class="workspace__role"
>
{{ roles[member.role] }}
</GhostBadge>
</li>
</ul>
</GhostTabsContent>
<GhostTabsContent value="activity" class="workspace__panel">
<p class="workspace__intro">
<bdi>The latest changes, newest first.</bdi>
</p>
<ol class="workspace__list">
<li
v-for="event in events"
:key="event.date"
class="workspace__event"
>
<span class="workspace__name">{{ event.text }}</span>
<time class="workspace__meta" :datetime="event.date">
{{ event.date }}
</time>
</li>
</ol>
</GhostTabsContent>
<GhostTabsContent value="billing" class="workspace__panel">
<p class="workspace__intro">
<bdi>Only workspace owners can see billing.</bdi>
</p>
</GhostTabsContent>
</div>
</GhostTabs>
</section>
</template>
<style scoped>
/*
* The example owns its measure (40rem) and shrinks with the preview. Native
* text inside picks up docs prose styles, so every element below resets the
* margins, padding, and list styles it relies on.
*/
.workspace {
display: grid;
gap: var(--ghost-space-stack-md);
grid-template-columns: minmax(0, 1fr);
max-inline-size: 40rem;
}
/* Title and layout switch stack on phones and share a row from 34rem. */
.workspace__header {
display: grid;
gap: var(--ghost-space-stack-sm);
grid-template-columns: minmax(0, 1fr);
}
@container ghost-demo (min-width: 34rem) {
.workspace__header {
align-items: start;
grid-template-columns: minmax(0, 1fr) auto;
}
}
.workspace__heading {
display: grid;
gap: var(--ghost-space-gap-xs);
min-inline-size: 0;
}
.workspace__title {
border: 0;
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-lg);
font-weight: var(--ghost-type-weight-semibold);
line-height: var(--ghost-type-line-tight);
margin: 0;
padding: 0;
}
.workspace__lead,
.workspace__intro {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-snug);
margin: 0;
}
/* A smaller label keeps all three layouts on one row at 320px. */
.workspace__layout {
font-size: var(--ghost-type-size-sm);
justify-self: start;
max-inline-size: 100%;
}
/* Explicit stack: strip first, panel below, both at full width. */
.workspace__tabs {
display: grid;
min-inline-size: 0;
}
/*
* Long labels wrap inside their tab instead of widening the
* strip; the themed list already wraps whole tabs onto a new row.
*/
.workspace__tab {
align-items: center;
display: inline-flex;
gap: var(--ghost-space-gap-xs);
max-inline-size: 100%;
overflow-wrap: anywhere;
text-align: start;
}
.workspace__count {
background-color: var(--ghost-surface-muted-bg);
border-radius: var(--ghost-radius-pill);
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-xs);
font-variant-numeric: tabular-nums;
line-height: var(--ghost-type-line-tight);
padding: 0 var(--ghost-space-inset-xs);
}
.workspace__panel {
display: grid;
gap: var(--ghost-space-stack-sm);
}
/* The native `hidden` attribute must still win over the grid display. */
.workspace__panel[hidden] {
display: none;
}
.workspace__stats {
display: grid;
gap: var(--ghost-space-stack-sm) var(--ghost-space-gap-md);
grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 1fr));
margin: 0;
}
.workspace__stat {
display: grid;
gap: var(--ghost-space-gap-xs);
}
.workspace__stat-label {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-xs);
line-height: var(--ghost-type-line-snug);
}
.workspace__stat-value {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-md);
font-weight: var(--ghost-type-weight-semibold);
line-height: var(--ghost-type-line-tight);
margin: 0;
}
.workspace__list {
display: grid;
list-style: none;
margin: 0;
padding: 0;
}
/*
* Avatar, person, and role share a row; below about 24rem the role badge
* moves under the name so long emails keep their width.
*/
.workspace__member {
align-items: center;
border-block-start: var(--ghost-border-hairline-width) solid
var(--ghost-border-default);
column-gap: var(--ghost-space-gap-md);
display: grid;
grid-template-areas:
'avatar person'
'avatar role';
grid-template-columns: auto minmax(0, 1fr);
margin: 0;
padding-block: var(--ghost-space-stack-sm);
row-gap: var(--ghost-space-gap-xs);
}
.workspace__member > :first-child {
grid-area: avatar;
}
.workspace__person {
display: grid;
grid-area: person;
justify-items: start;
min-inline-size: 0;
}
.workspace__role {
grid-area: role;
justify-self: start;
}
@container ghost-demo (min-width: 24rem) {
.workspace__member {
grid-template-areas: 'avatar person role';
grid-template-columns: auto minmax(0, 1fr) auto;
}
}
.workspace__event {
border-block-start: var(--ghost-border-hairline-width) solid
var(--ghost-border-default);
display: grid;
gap: var(--ghost-space-gap-xs);
justify-items: start;
margin: 0;
padding-block: var(--ghost-space-stack-sm);
}
.workspace__member:first-child,
.workspace__event:first-child {
border-block-start: 0;
}
.workspace__name {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-sm);
font-weight: var(--ghost-type-weight-medium);
line-height: var(--ghost-type-line-snug);
overflow-wrap: anywhere;
}
.workspace__meta {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-xs);
line-height: var(--ghost-type-line-snug);
max-inline-size: 100%;
overflow-wrap: anywhere;
}
</style>
The workspace page switches between Overview, Members, and Activity panels. Billing is a disabled tab: it stays visible but arrow keys skip it and clicks do nothing. Because GhostTabs renders no element, the example wraps the list and the panels in one grid so the strip always sits above the panel; the themed panel's top margin is the gap between them. The selected tab is raised on the elevation-2 surface, an unselected tab tints on hover, and focus draws an outline ring, so neither hover nor focus moves the strip.
The Tab layout switch exercises long labels and right-to-left layout with deterministic local copy. Long swaps in labels such as Members and permissions, which wrap inside their tab, and the strip wraps whole tabs onto a new row in narrow previews. RTL sets dir="rtl" on the example root; the tab list reads the nearest dir, so ArrowLeft moves to the next tab and ArrowRight to the previous one. The English sentences sit in <bdi> so their punctuation and leading numbers stay in place inside the mirrored layout. Class names passed to GhostTabsList, GhostTabsTrigger, and GhostTabsContent are merged with the part classes, so example-owned layout classes sit beside the themed styles.
| Key | Behavior |
|---|---|
Tab | Moves into the strip on the selected tab, then into the panel. |
ArrowRight / ArrowLeft | Next / previous enabled tab, wrapping at the ends (mirrored RTL). |
ArrowDown / ArrowUp | Next / previous enabled tab in a vertical list. |
Home / End | First / last enabled tab. |
Enter / Space | Selects the focused tab in manual activation mode. |
In the default automatic mode, moving focus to a tab also selects it. Arrow, Home, and End combined with Alt, Ctrl, or Meta are left to the platform.
Themed vertical workspace tabs with manual activation and a responsive list and panel layout.
<script setup lang="ts">
import {
GhostTabs,
GhostTabsContent,
GhostTabsList,
GhostTabsTrigger,
} from '@ghostvue/themes'
</script>
<template>
<GhostTabs
orientation="vertical"
activation-mode="manual"
default-value="overview"
>
<div class="review-sections">
<GhostTabsList aria-label="Release review">
<GhostTabsTrigger value="overview">Overview</GhostTabsTrigger>
<GhostTabsTrigger value="checks">Release checks</GhostTabsTrigger>
<GhostTabsTrigger value="changes">Recent changes</GhostTabsTrigger>
</GhostTabsList>
<GhostTabsContent value="overview">
Review the release candidate before publishing.
</GhostTabsContent>
<GhostTabsContent value="checks">
Two checks remain before this release can be approved.
</GhostTabsContent>
<GhostTabsContent value="changes">
The candidate includes updated onboarding translations.
</GhostTabsContent>
</div>
</GhostTabs>
</template>
<style scoped>
.review-sections {
display: grid;
gap: var(--ghost-space-gap-md);
/* The renderless root leaves the relationship of list and panel to the app. */
grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
align-items: start;
}
</style>
In this release review, ArrowDown moves focus to Release checks while Overview stays selected. Press Enter or Space to show the checks panel. Use activation-mode="manual" when switching panels can start work, such as loading records, and the user should be able to inspect tab labels first.
orientation="vertical" sets aria-orientation="vertical" and maps ArrowUp and ArrowDown to the previous and next tab. The release review example places the list beside the panel where both columns fit and stacks them at narrower widths. For long horizontal tab labels, allow the list to wrap while leaving the arrow order in document order, as in the workspace lead.
Plain themed tab panels inside a card, switching the install command per package manager.
pnpm add @ghostvue/themesnpm install @ghostvue/themesyarn add @ghostvue/themes<script setup lang="ts">
import {
GhostCard,
GhostTabs,
GhostTabsContent,
GhostTabsList,
GhostTabsTrigger,
} from '@ghostvue/themes'
const managers = [
{ value: 'pnpm', label: 'pnpm', command: 'pnpm add @ghostvue/themes' },
{ value: 'npm', label: 'npm', command: 'npm install @ghostvue/themes' },
{ value: 'yarn', label: 'Yarn', command: 'yarn add @ghostvue/themes' },
] as const
</script>
<template>
<div class="install-commands">
<GhostCard>
<template #header>
<div class="install-commands__titles">
<span id="install-commands-title" class="install-commands__title">
Install the theme package
</span>
<span class="install-commands__meta">
Pick your package manager and run the command in your app.
</span>
</div>
</template>
<!--
The card already draws the border and padding, so each panel uses
variant="plain" instead of drawing a second frame inside it. The
panels stay tab stops with the same focus ring.
-->
<GhostTabs default-value="pnpm">
<div class="install-commands__tabs">
<GhostTabsList aria-labelledby="install-commands-title">
<GhostTabsTrigger
v-for="manager in managers"
:key="manager.value"
:value="manager.value"
>
{{ manager.label }}
</GhostTabsTrigger>
</GhostTabsList>
<GhostTabsContent
v-for="manager in managers"
:key="manager.value"
:value="manager.value"
variant="plain"
>
<code class="install-commands__command">{{ manager.command }}</code>
</GhostTabsContent>
</div>
</GhostTabs>
</GhostCard>
</div>
</template>
<style scoped>
.install-commands {
display: grid;
max-inline-size: 32rem;
}
.install-commands__titles {
display: grid;
gap: var(--ghost-space-gap-xs);
}
.install-commands__title {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-md);
font-weight: var(--ghost-type-weight-semibold);
line-height: var(--ghost-type-line-snug);
}
.install-commands__meta {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-normal);
}
.install-commands__tabs {
display: grid;
}
.install-commands__command {
color: var(--ghost-text-default);
font-family: var(--ghost-type-family-mono);
font-size: var(--ghost-type-size-sm);
overflow-wrap: anywhere;
}
</style>
The install card already draws a border and padding, so each panel sets variant="plain" on GhostTabsContent. A plain panel has no border, corner radius, background, or inset padding of its own; the small gap between the tab strip and the panel stays. The panel is still a tab stop and draws the same focus ring as the tabs. Keep the default variant="framed" when the tabs sit on the page by themselves.
Themed strip stacked above its panel, with a disabled tab, from @ghostvue/themes.
<script setup lang="ts">
import {
GhostTabs,
GhostTabsContent,
GhostTabsList,
GhostTabsTrigger,
} from '@ghostvue/themes'
</script>
<template>
<GhostTabs default-value="overview">
<!--
GhostTabs renders no element, so this block keeps the strip and the
panel in one stack: the panel always sits below the list instead of
flowing beside it inside a flex or grid parent.
-->
<div class="tabs">
<GhostTabsList aria-label="Project">
<GhostTabsTrigger value="overview">Overview</GhostTabsTrigger>
<GhostTabsTrigger value="members">Members</GhostTabsTrigger>
<GhostTabsTrigger value="audit">Audit log</GhostTabsTrigger>
<GhostTabsTrigger value="exports" disabled>Exports</GhostTabsTrigger>
</GhostTabsList>
<GhostTabsContent value="overview">
Workspace summary and usage snapshots.
</GhostTabsContent>
<GhostTabsContent value="members">
Invite collaborators and manage roles.
</GhostTabsContent>
<GhostTabsContent value="audit">
Review sign-in events from the past 30 days.
</GhostTabsContent>
<GhostTabsContent value="exports">
Download workspace data as CSV.
</GhostTabsContent>
</div>
</GhostTabs>
</template>
<style scoped>
.tabs {
display: grid;
max-inline-size: 36rem;
}
</style>
Themed list, trigger, and content parts set data-themed so elevated surfaces and focus rings apply under .ghost-theme or .ghost-themed-scope. Unselected tabs tint on hover, disabled tabs use the disabled opacity with a not-allowed cursor, and the focusable active panel draws the same focus ring as the tabs. In forced-colors mode the selected tab is painted with Highlight and HighlightText.
Small tab strip in a header beside a small input and button.
<script setup lang="ts">
import { ref } from 'vue'
import {
GhostButton,
GhostInput,
GhostTabs,
GhostTabsContent,
GhostTabsList,
GhostTabsTrigger,
} from '@ghostvue/themes'
const views = [
{ value: 'all', label: 'All', summary: '42 invoices this quarter.' },
{
value: 'open',
label: 'Open',
summary: '7 invoices are waiting on payment.',
},
{ value: 'paid', label: 'Paid', summary: '35 invoices are paid in full.' },
] as const
const search = ref('')
</script>
<template>
<!--
size="sm" on GhostTabsList sizes every trigger to match the small input
and button in the header. Panels keep their padding at every size.
-->
<GhostTabs default-value="all">
<div class="invoice-header">
<GhostTabsList size="sm" aria-label="Invoice status">
<GhostTabsTrigger
v-for="view in views"
:key="view.value"
:value="view.value"
>
{{ view.label }}
</GhostTabsTrigger>
</GhostTabsList>
<GhostInput
v-model="search"
size="sm"
type="search"
aria-label="Search invoices"
placeholder="Search invoices"
/>
<GhostButton size="sm">New invoice</GhostButton>
</div>
<GhostTabsContent
v-for="view in views"
:key="view.value"
:value="view.value"
>
{{ view.summary }}
</GhostTabsContent>
</GhostTabs>
</template>
<style scoped>
.invoice-header {
align-items: center;
display: flex;
flex-wrap: wrap;
gap: var(--ghost-space-gap-sm);
}
</style>
Set size to sm, md (the default) or lg on the themed GhostTabsList to match a GhostButton or GhostInput of the same size. Every trigger in the list takes its height, label size and padding from control.size.<size>. Panels keep their padding at every size. GhostTabs renders no element, so the size lives on the list. On touch screens every size keeps a 44px trigger.
Controlled compound tabs with automatic activation.
<script setup lang="ts">
import { ref } from 'vue'
import {
GhostTabs,
GhostTabsContent,
GhostTabsList,
GhostTabsTrigger,
} from '@ghostvue/vue'
const selected = ref('profile')
</script>
<template>
<GhostTabs v-model="selected">
<!-- GhostTabs renders no element; this block keeps the panel under the list. -->
<div class="tabs">
<GhostTabsList aria-label="Account settings">
<GhostTabsTrigger value="profile">Profile</GhostTabsTrigger>
<GhostTabsTrigger value="billing">Billing</GhostTabsTrigger>
<GhostTabsTrigger value="security">Security</GhostTabsTrigger>
</GhostTabsList>
<GhostTabsContent value="profile">
Manage your public profile and contact details.
</GhostTabsContent>
<GhostTabsContent value="billing">
Review invoices and payment methods.
</GhostTabsContent>
<GhostTabsContent value="security">
Rotate passwords and review active sessions.
</GhostTabsContent>
</div>
</GhostTabs>
</template>
<style scoped>
.tabs {
display: grid;
gap: var(--ghost-space-stack-sm);
}
</style>
The parts from @ghostvue/vue manage selection, focus, and the relationships between tabs and panels. Supply your own styles for the manual and vertical patterns.
Tabs activate on click or Enter/Space instead of focus.
<script setup lang="ts">
import {
GhostTabs,
GhostTabsContent,
GhostTabsList,
GhostTabsTrigger,
} from '@ghostvue/vue'
</script>
<template>
<!-- Arrow keys only move focus; Enter, Space, or a click selects. -->
<GhostTabs activation-mode="manual" default-value="drafts">
<div class="tabs">
<GhostTabsList aria-label="Mailboxes">
<GhostTabsTrigger value="inbox">Inbox</GhostTabsTrigger>
<GhostTabsTrigger value="drafts">Drafts</GhostTabsTrigger>
<GhostTabsTrigger value="sent">Sent</GhostTabsTrigger>
</GhostTabsList>
<GhostTabsContent value="inbox">
Unread messages arrive here.
</GhostTabsContent>
<GhostTabsContent value="drafts">
Work-in-progress messages stay local.
</GhostTabsContent>
<GhostTabsContent value="sent">
Messages you've already sent.
</GhostTabsContent>
</div>
</GhostTabs>
</template>
<style scoped>
.tabs {
display: grid;
gap: var(--ghost-space-stack-sm);
}
</style>
Vertical tab list beside its panel, stacking above it in narrow previews.
<script setup lang="ts">
import {
GhostTabs,
GhostTabsContent,
GhostTabsList,
GhostTabsTrigger,
} from '@ghostvue/vue'
</script>
<template>
<!-- ArrowUp and ArrowDown move between tabs in a vertical list. -->
<GhostTabs orientation="vertical" default-value="overview">
<div class="tabs">
<GhostTabsList aria-label="Record" class="tabs__list">
<GhostTabsTrigger value="overview">Overview</GhostTabsTrigger>
<GhostTabsTrigger value="details">Details</GhostTabsTrigger>
<GhostTabsTrigger value="history">History</GhostTabsTrigger>
</GhostTabsList>
<GhostTabsContent value="overview">
High-level summary of the current record.
</GhostTabsContent>
<GhostTabsContent value="details">
Field-level metadata and validation rules.
</GhostTabsContent>
<GhostTabsContent value="history">
Audit trail of the most recent edits.
</GhostTabsContent>
</div>
</GhostTabs>
</template>
<style scoped>
/* The list stacks above the panel when narrow and sits beside it from 24rem. */
.tabs {
display: grid;
gap: var(--ghost-space-stack-sm) var(--ghost-space-gap-md);
}
.tabs__list {
display: flex;
flex-direction: column;
align-items: flex-start;
}
@container ghost-demo (min-width: 24rem) {
.tabs {
align-items: start;
grid-template-columns: auto minmax(0, 1fr);
}
}
</style>
See the specification for the full contract. Generated manifest data is available under packages/vue/manifests/ghost-tabs*.manifest.json.
| Prop | Type | Default | Description |
|---|---|---|---|
activationMode | 'automatic' | 'manual' | "automatic" | Focus-driven (automatic) vs explicit activation (manual) tab selection. |
defaultValue | string | — | Initial selected value when modelValue is omitted. |
dir | 'ltr' | 'rtl' | — | Explicit text direction for roving focus within the tab list. |
modelValue | string | — | Controlled selected tab value. Omit for uncontrolled mode. |
orientation | 'horizontal' | 'vertical' | "horizontal" | Tab list orientation for arrow-key roving and aria-orientation. |
| Slot | Slot props | Description |
|---|---|---|
default | modelValue: string | undefined | Container content. |
@ghostvue/themes adds no props, events, or slots to the headless GhostTabs API, which it forwards.
| Part | Role | Key attributes |
|---|---|---|
GhostTabs | — | v-model, activationMode, orientation, dir |
GhostTabsList | tablist | aria-orientation |
GhostTabsTrigger | tab | value, aria-selected, aria-controls |
GhostTabsContent | tabpanel | value, aria-labelledby, hidden when inactive |
GhostTabsList The themed list adds size. sm and lg render data-size on the list; the default md renders none.
@ghostvue/themes adds these to the headless GhostTabsList API, which it forwards:
| Prop | Type | Default | Description |
|---|---|---|---|
size | 'sm' | 'md' | 'lg' | "md" | Height, label size, and padding of every trigger in the list from control.size.<size>, matching a GhostButton or GhostInput of the same size. Panels keep their padding at every size. The default omits data-size so CSS can treat a missing hook as md. |
GhostTabsContent The themed panel adds variant. plain renders data-variant="plain"; the default framed renders no data-variant.
@ghostvue/themes adds these to the headless GhostTabsContent API, which it forwards:
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'framed' | 'plain' | "framed" | Panel frame. framed draws the elevated background, border, radius, and inset padding. plain draws none of them, for a panel inside a surface that already frames it. The panel stays a tab stop with the same focus ring. The default omits data-variant. |
Follow the tabs specification for the keyboard map and assistive-technology relationships. Disabled triggers are skipped during roving navigation.