Skip to content

GhostTabs ​

GhostTabs 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 sections

Workspace overview, members, and activity panels with a disabled tab, counts, long labels, and a right-to-left layout switch.

Northwind design workspace

Plan, people, and recent changes for the design systems team.

Team plan, renewed every November.

Members
4 of 10 seats
Projects
14 active
Storage
18.4 GB of 50 GB

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.

Keyboard ​

KeyBehavior
TabMoves into the strip on the selected tab, then into the panel.
ArrowRight / ArrowLeftNext / previous enabled tab, wrapping at the ends (mirrored RTL).
ArrowDown / ArrowUpNext / previous enabled tab in a vertical list.
Home / EndFirst / last enabled tab.
Enter / SpaceSelects 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.

Manual activation ​

Release review sections

Themed vertical workspace tabs with manual activation and a responsive list and panel layout.

Review the release candidate before publishing.

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.

Vertical orientation ​

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.

Inside a card or code block ​

Install commands in a card

Plain themed tab panels inside a card, switching the install command per package manager.

Install the theme package Pick your package manager and run the command in your app.
pnpm add @ghostvue/themes

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 use ​

Themed

Themed strip stacked above its panel, with a disabled tab, from @ghostvue/themes.

Workspace summary and usage snapshots.

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.

Size ​

Size

Small tab strip in a header beside a small input and button.

42 invoices this quarter.

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.

Advanced: headless composition ​

Basic use ​

Basic Headless

Controlled compound tabs with automatic activation.

Manage your public profile and contact details.

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.

Manual activation Headless

Tabs activate on click or Enter/Space instead of focus.

Work-in-progress messages stay local.
Vertical Headless

Vertical tab list beside its panel, stacking above it in narrow previews.

High-level summary of the current record.

API ​

See the specification for the full contract. Generated manifest data is available under packages/vue/manifests/ghost-tabs*.manifest.json.

PropTypeDefaultDescription
activationMode'automatic' | 'manual'"automatic"Focus-driven (automatic) vs explicit activation (manual) tab selection.
defaultValuestring—Initial selected value when modelValue is omitted.
dir'ltr' | 'rtl'—Explicit text direction for roving focus within the tab list.
modelValuestring—Controlled selected tab value. Omit for uncontrolled mode.
orientation'horizontal' | 'vertical'"horizontal"Tab list orientation for arrow-key roving and aria-orientation.
SlotSlot propsDescription
defaultmodelValue: string | undefinedContainer content.

@ghostvue/themes adds no props, events, or slots to the headless GhostTabs API, which it forwards.

PartRoleKey attributes
GhostTabs—v-model, activationMode, orientation, dir
GhostTabsListtablistaria-orientation
GhostTabsTriggertabvalue, aria-selected, aria-controls
GhostTabsContenttabpanelvalue, 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:

PropTypeDefaultDescription
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:

PropTypeDefaultDescription
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.

Accessibility ​

Follow the tabs specification for the keyboard map and assistive-technology relationships. Disabled triggers are skipped during roving navigation.