Skip to content
All components
Navigation

Tabs

Switch between peer panels of related content in the same place, showing one panel at a time without leaving the page.

A tab list with a raised active state.

Installation

tdpxl is not an npm dependency of your app. The @tdpxl/cli command (not published to npm yet) copies the source into your project, with the registry items and npm packages it imports.

npx @tdpxl/cli add tabs

Then import it from @/components/ui/tabs. New project? Start with the installation guide.

Examples

Each example is one branch of the official demo, rendered in its own frame. The code is that branch as you would write it, with imports pointing at the default install paths.

Vertical

Stack tabs beside their panel with vertical orientation. Arrow Up and Arrow Down move between tabs; use it for settings-style sections.

"use client"

import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"

export function TabsVertical() {
  
  return (
    <div className="flex w-full flex-col gap-8">
      <Tabs defaultValue="profile" orientation="vertical" className="w-full max-w-lg">
        <TabsList>
          <TabsTrigger value="profile">Profile</TabsTrigger>
          <TabsTrigger value="security">Security</TabsTrigger>
          <TabsTrigger value="notifications">Notifications</TabsTrigger>
        </TabsList>
        <TabsContent value="profile" className="text-paragraph-sm text-sub-600">
          Your name, photo and the email address other members see.
        </TabsContent>
        <TabsContent value="security" className="text-paragraph-sm text-sub-600">
          Password, two-step verification and active sessions.
        </TabsContent>
        <TabsContent value="notifications" className="text-paragraph-sm text-sub-600">
          Which events send an email and which only appear in the app.
        </TabsContent>
      </Tabs>
    </div>
  )
}

Controlled manual

Own the selected tab in parent state with manual activation. Arrow keys only move focus; Enter or Space selects, and a parent button can change the value.

"use client"

import * as React from "react"

import { Button } from "@/components/ui/button"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"

export function TabsControlledManual() {
  const [period, setPeriod] = React.useState("week")
  return (
    <div className="flex w-full flex-col gap-8">
      <div className="flex w-full max-w-md flex-col gap-3">
        <div className="flex flex-wrap items-center gap-2">
          <Button size="sm" intent="neutral" emphasis="stroke" onClick={() => setPeriod("week")}>
            Reset to this week
          </Button>
          <p className="text-paragraph-sm text-sub-600" aria-live="polite">
            Showing: {period === "week" ? "this week" : period === "month" ? "this month" : "this year"}
          </p>
        </div>
        <Tabs value={period} onValueChange={setPeriod} activationMode="manual">
          <TabsList aria-label="Reporting period">
            <TabsTrigger value="week">This week</TabsTrigger>
            <TabsTrigger value="month">This month</TabsTrigger>
            <TabsTrigger value="year">This year</TabsTrigger>
          </TabsList>
          <TabsContent value="week" className="text-paragraph-sm text-sub-600">
            128 orders, 4 refunds.
          </TabsContent>
          <TabsContent value="month" className="text-paragraph-sm text-sub-600">
            531 orders, 17 refunds.
          </TabsContent>
          <TabsContent value="year" className="text-paragraph-sm text-sub-600">
            6,204 orders, 190 refunds.
          </TabsContent>
        </Tabs>
      </div>
    </div>
  )
}

Icons and disabled

Pair tab labels with icons and skip an unavailable tab. Icons are decorative; the disabled tab is not focusable with arrow keys.

"use client"

import { ArchiveIcon, BellIcon, InboxIcon, SendIcon } from "lucide-react"

import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"

export function TabsIconsAndDisabled() {
  
  return (
    <div className="flex w-full flex-col gap-8">
      <Tabs defaultValue="inbox" className="w-full max-w-md">
        <TabsList aria-label="Mailboxes" className="max-w-full justify-start overflow-x-auto">
          <TabsTrigger value="inbox" className="shrink-0">
            <InboxIcon aria-hidden="true" />
            Inbox
          </TabsTrigger>
          <TabsTrigger value="sent" className="shrink-0">
            <SendIcon aria-hidden="true" />
            Sent
          </TabsTrigger>
          <TabsTrigger value="alerts" className="shrink-0">
            <BellIcon aria-hidden="true" />
            Alerts
          </TabsTrigger>
          <TabsTrigger value="archive" disabled className="shrink-0">
            <ArchiveIcon aria-hidden="true" />
            Archive
          </TabsTrigger>
        </TabsList>
        <TabsContent value="inbox" className="text-paragraph-sm text-sub-600">
          Three unread conversations.
        </TabsContent>
        <TabsContent value="sent" className="text-paragraph-sm text-sub-600">
          Messages you sent in the last 30 days.
        </TabsContent>
        <TabsContent value="alerts" className="text-paragraph-sm text-sub-600">
          System alerts for this workspace.
        </TabsContent>
        <TabsContent value="archive" className="text-paragraph-sm text-sub-600">
          The archive is available on paid plans.
        </TabsContent>
      </Tabs>
    </div>
  )
}

Scrollable list

Let many tabs scroll horizontally in a narrow container. Arrow keys still reach every tab and the page itself does not overflow.

"use client"

import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"

const reportTabs = [
  { value: "summary", label: "Summary" },
  { value: "traffic", label: "Traffic" },
  { value: "conversions", label: "Conversions" },
  { value: "retention", label: "Retention" },
  { value: "revenue", label: "Revenue" },
  { value: "exports", label: "Exports" },
]

export function TabsScrollableList() {
  
  return (
    <div className="flex w-full flex-col gap-8">
      <Tabs defaultValue="summary" className="w-full max-w-xs">
        <TabsList aria-label="Report sections" className="w-full max-w-full justify-start overflow-x-auto">
          {reportTabs.map((tab) => (
            <TabsTrigger key={tab.value} value={tab.value} className="shrink-0">
              {tab.label}
            </TabsTrigger>
          ))}
        </TabsList>
        {reportTabs.map((tab) => (
          <TabsContent key={tab.value} value={tab.value} className="text-paragraph-sm text-sub-600">
            {tab.label} for the selected date range.
          </TabsContent>
        ))}
      </Tabs>
    </div>
  )
}

Underline

Use underline tabs for page sections. The 2px indicator sits on the list border and remains visible in forced colors.

"use client"

import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"

export function TabsUnderline() {
  
  return (
    <div className="flex w-full flex-col gap-8">
      <Tabs defaultValue="overview" className="w-full max-w-md">
        <TabsList variant="underline" aria-label="Project sections">
          <TabsTrigger value="overview">Overview</TabsTrigger>
          <TabsTrigger value="activity">Activity</TabsTrigger>
          <TabsTrigger value="files">Files</TabsTrigger>
          <TabsTrigger value="settings">Settings</TabsTrigger>
        </TabsList>
        <TabsContent value="overview" className="text-paragraph-sm text-sub-600">
          Overview for this project.
        </TabsContent>
        <TabsContent value="activity" className="text-paragraph-sm text-sub-600">
          Activity for this project.
        </TabsContent>
        <TabsContent value="files" className="text-paragraph-sm text-sub-600">
          Files for this project.
        </TabsContent>
        <TabsContent value="settings" className="text-paragraph-sm text-sub-600">
          Settings for this project.
        </TabsContent>
      </Tabs>
    </div>
  )
}

Pill

Use pill tabs without a container. The active tab gets a filled background and stronger text.

"use client"

import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"

export function TabsPill() {
  
  return (
    <div className="flex w-full flex-col gap-8">
      <Tabs defaultValue="plan" className="w-full max-w-md">
        <TabsList variant="pill" aria-label="Billing sections">
          <TabsTrigger value="plan">Plan</TabsTrigger>
          <TabsTrigger value="invoices">Invoices</TabsTrigger>
          <TabsTrigger value="payment">Payment method</TabsTrigger>
        </TabsList>
        <TabsContent value="plan" className="text-paragraph-sm text-sub-600">
          Plan for this account.
        </TabsContent>
        <TabsContent value="invoices" className="text-paragraph-sm text-sub-600">
          Invoices for this account.
        </TabsContent>
        <TabsContent value="payment" className="text-paragraph-sm text-sub-600">
          Payment method for this account.
        </TabsContent>
      </Tabs>
    </div>
  )
}

Bordered

Use bordered tabs as joined segments. Each trigger is an outlined segment; focus outlines are drawn inside so the container does not clip them.

"use client"

import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"

export function TabsBordered() {
  
  return (
    <div className="flex w-full flex-col gap-8">
      <Tabs defaultValue="day" className="w-full max-w-md">
        <TabsList variant="bordered" aria-label="Chart range">
          <TabsTrigger value="day">Day</TabsTrigger>
          <TabsTrigger value="week">Week</TabsTrigger>
          <TabsTrigger value="month">Month</TabsTrigger>
          <TabsTrigger value="year">Year</TabsTrigger>
        </TabsList>
        <TabsContent value="day" className="text-paragraph-sm text-sub-600">
          Day for this chart.
        </TabsContent>
        <TabsContent value="week" className="text-paragraph-sm text-sub-600">
          Week for this chart.
        </TabsContent>
        <TabsContent value="month" className="text-paragraph-sm text-sub-600">
          Month for this chart.
        </TabsContent>
        <TabsContent value="year" className="text-paragraph-sm text-sub-600">
          Year for this chart.
        </TabsContent>
      </Tabs>
    </div>
  )
}

API reference

Generated from the component's TypeScript signatures. Inherited DOM and primitive props are listed separately.

Tabs

Switch between related panels within a shared interface.

Tabs props
PropTypeDefaultDescription
valuestring | undefined—The value for the selected tab, if controlled
defaultValuestring | undefined—The value of the tab to select by default, if uncontrolled
onValueChange((value: string) => void) | undefined—A function called when a new tab is selected
orientation("horizontal" | "vertical") | undefined—The orientation the tabs are layed out. Mainly so arrow navigation is done accordingly (left & right vs. up & down)
dir("ltr" | "rtl") | undefined—The direction of navigation between toolbar items.
activationMode("manual" | "automatic") | undefined—Whether a tab is activated automatically or manually.
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (13)
Tabs inherited props
PropTypeDefaultDescription
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
asChildboolean | undefined—Merge this part into one child instead of its default element. Preserve that child's semantics, ref support and accessibility attributes.
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

TabsContent

Content region within the root composition. Keep required providers, labels and related controls from the complete example.

TabsContent props
PropTypeDefaultDescription
forceMounttrue | undefined—Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (15)
TabsContent inherited props
PropTypeDefaultDescription
value(required)string—Current value in the shape defined by the source type. For controlled interactive inputs, apply updates from the change callback.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
asChildboolean | undefined—Merge this part into one child instead of its default element. Preserve that child's semantics, ref support and accessibility attributes.
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

TabsList

The TabsList part of tabs. Use it with the complete source composition and preserve its required parent context.

TabsList props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
variantTabsVariant | undefined"segmented"Visual style shared by every trigger in this list: segmented (contained), underline, pill (filled active tab, no container) or bordered (joined outlined segments). Defaults to segmented.
Inherited props (15)
TabsList inherited props
PropTypeDefaultDescription
loopboolean | undefined—Allow keyboard navigation to wrap between the first and last eligible items.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
asChildboolean | undefined—Merge this part into one child instead of its default element. Preserve that child's semantics, ref support and accessibility attributes.
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

TabsTrigger

Interactive control that opens or toggles the associated content. Preserve its accessible name and the required root context.

TabsTrigger props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (19)
TabsTrigger inherited props
PropTypeDefaultDescription
value(required)string—Current value in the shape defined by the source type. For controlled interactive inputs, apply updates from the change callback.
formstring | undefined—ID of the form associated with this control, including when it is rendered outside that form element.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLButtonElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLButtonElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLButtonElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLButtonElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLButtonElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLButtonElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
asChildboolean | undefined—Merge this part into one child instead of its default element. Preserve that child's semantics, ref support and accessibility attributes.
disabledboolean | undefined—Make the supported control unavailable through its native or primitive disabled semantics. This does not disable arbitrary child links.
namestring | undefined—Name used by the control's form submission or primitive form integration.
type"button" | "submit" | "reset" | undefined—Native element or primitive mode defined by the source union. Choose a supported value; its meaning depends on the component.
refReact.Ref<HTMLButtonElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

Accessibility & usage

From registry/ui/tabs.meta.json (authored guidance; human review may still be pending). Behavior is checked by Storybook tests, not certified here.

When to use

  • Two to about seven sibling views of the same object (Overview, Activity, Settings) that people compare or visit in any order.
  • Reducing a long page when users rarely need all sections at once and each section stands on its own.
  • A settings area with a side list: set orientation="vertical" so the list stacks and Arrow Up/Down move between tabs.
  • Panels that are expensive to render or fetch: set activationMode="manual" so arrow keys only move focus and Enter or Space selects.

When not to use

  • Sequential steps that must be completed in order; use a stepper or a multi-step form with explicit Next/Back actions.
  • Navigating between pages or routes with their own URL; use links in navigation (a navigation menu, a sidebar or plain links).
  • A mutually exclusive form value; a radio group or toggle group submits and validates with the form.
  • Content users need to read side by side or scan together; hiding it in tabs forces memory and extra clicks.

Anatomy

Tabs
Root. Owns the selected value (value/onValueChange or defaultValue), orientation, dir and activationMode.
TabsList
The tablist. variant is segmented (contained, default), underline (2px indicator on a bottom border), pill (filled active tab without a container) or bordered (joined outlined segments); triggers inherit it. Give it aria-label when the surrounding heading does not already name the set.
TabsTrigger
One tab (role tab) with a value. Supports disabled; decorative icons sit before the label.
TabsContent
The panel (role tabpanel) for the matching value, labelled by its tab. Focusable so keyboard users can reach panels without focusable content; keeps a visible focus outline.

Keyboard & interaction

  • Follows the WAI-ARIA APG tabs pattern through Radix: only the selected tab is in the Tab order, so one Tab press enters the list and the next moves into the panel.
  • Arrow Left/Right (or Up/Down with orientation="vertical") move between tabs and wrap; Home and End jump to the first and last tab. Horizontal arrows flip with dir="rtl".
  • Automatic activation (default) selects a tab as soon as it receives focus; activationMode="manual" requires Enter or Space, which avoids loading panels while users arrow past them.
  • Disabled tabs are skipped by arrow keys and cannot be selected by pointer.
  • Controlled value lets a parent select a tab (for example from a link or the URL); onValueChange reports user changes.
  • Inactive panels are unmounted by default; keep form state outside the panel or lift it to the parent when switching must not lose input.

Responsive behavior

  • At 320px CSS width, many or long tabs must not cause page-level horizontal scroll (WCAG 1.4.10): let the TabsList scroll horizontally inside its container, shorten labels, or switch to a select or accordion on narrow screens.
  • Keyboard focus moved by arrow keys scrolls a scrollable list so the focused tab is visible; check it is not hidden behind fades or sticky elements (WCAG 2.4.11).
  • Vertical tabs need horizontal room; below a breakpoint, stack the list above the panel or use horizontal tabs instead.
  • Keep each tab at least 24x24 CSS pixels (WCAG 2.5.8), and larger on touch-first layouts.

Content guidelines

  • Label tabs with one or two words that name the panel's content ('Activity', 'Members'), in sentence case.
  • Keep labels parallel in grammar and similar in length; do not use verbs, since selecting a tab is not an action.
  • Order tabs by frequency of use, with the most common first and selected by default.
  • Counts can follow a label ('Inbox 3') but must be part of the tab's text so they are announced.
  • Give the set a name with aria-label on TabsList when no visible heading introduces it.

Alternatives

  • Toggle group — Switch a display mode of one view (list or grid) rather than swapping whole panels.
  • Radio group — A mutually exclusive choice that is part of a form.
  • Accordion — Stacked sections that can open together and work better on narrow screens.
  • Navigation menu — Navigation between pages with real links.

Resources