VDS

Tabs

Organize content into switchable panels.

Installation

pnpm install @vds-testing/react @vds-testing/styles
pnpm install @vds-testing/elements @vds-testing/styles

See Installation for CSS setup.

Usage

React:

import {
  Tabs,
  TabsList,
  TabsTrigger,
} from "@vds-testing/react"
<Tabs defaultValue="all">
  <TabsList>
    <TabsTrigger value="all">All</TabsTrigger>
    <TabsTrigger value="adult">Adult</TabsTrigger>
    <TabsTrigger value="joint">Joint</TabsTrigger>
    <TabsTrigger value="family">Family</TabsTrigger>
    <TabsTrigger value="young-person">Young Person</TabsTrigger>
  </TabsList>
</Tabs>

Web Components:

<script type="module">
  import "@vds-testing/elements";
</script>
<vds-tabs default-value="all">
  <vds-tabs-list>
    <vds-tabs-trigger value="all">All</vds-tabs-trigger>
    <vds-tabs-trigger value="adult">Adult</vds-tabs-trigger>
    <vds-tabs-trigger value="joint">Joint</vds-tabs-trigger>
    <vds-tabs-trigger value="family">Family</vds-tabs-trigger>
    <vds-tabs-trigger value="young-person">Young Person</vds-tabs-trigger>
  </vds-tabs-list>
</vds-tabs>

Examples

Default

Anatomy

  • Tabs - The root container that manages state
  • TabsList - Container for tab triggers
  • TabsTrigger - Individual tab buttons

Accessibility

Keyboard and focus follow WCAG 2.2 AA expectations for operable UI:

  • Every enabled tab is in the tab order (tabindex="0"), so Tab / Shift+Tab move focus across all tabs — not only the active one.
  • Arrow Left / Arrow Right move focus and select the next/previous tab.
  • Home / End jump to the first/last tab.
  • Enter / Space select the focused tab.
  • Each trigger uses the shared focus-text style (focus-visible).
  • The list exposes role="tablist" with aria-orientation="horizontal"; triggers use role="tab" and aria-selected.

Props

Tabs

Prop Type Default Description
defaultValue string - Initially active tab value
value string - Controlled active tab value (React)
onValueChange (value: string) => void - Called when the active tab changes (React)
class / className string - Additional CSS classes

TabsTrigger

Prop Type Default Description
value string required Unique identifier for the tab
class / className string - Additional CSS classes

Web Components use kebab-case attributes (default-value on vds-tabs).