Skip to content

Design system

Documentation

DesignComponents / Tabs

Components / Tabs

Beta

Tabs

Use Tabs to switch between peer views while keeping the navigation set visible and keyboard-accessible.

On this page

Examples

Peer views

A visible tab list keeps the current subject in place while switching panels.

24 teammates are active across 6 projects.

Tabs preview with overview and activity panels

Controlled active tab

The feature can coordinate the selected tab with surrounding state.

Summary panel.

Current tab: overview

Controlled Tabs with current value

Disabled tab

A tab can remain visible while unavailable in the current context.

Only the available view can be selected.

Tabs with a disabled trigger

Labels with icons

Decorative icons reinforce short labels without replacing them.

Icon plus label keeps the view identifiable.

Tabs with decorative icons

Long panel content

Panel content wraps and scrolls with the surrounding page instead of clipping.

A long panel keeps its reading order and uses the page scroll region.

A long panel keeps its reading order and uses the page scroll region.

A long panel keeps its reading order and uses the page scroll region.

A long panel keeps its reading order and uses the page scroll region.

A long panel keeps its reading order and uses the page scroll region.

Tabs with long panel content

When to use

Use Tabs for peer views of the same subject where people may move between sections without losing context. Use navigation links for different resources and an accordion when several sections should be open in a single flow.

Usage

tabs-basic.tsx
"use client";

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

export function Example() {
  return (
    <Tabs defaultValue="overview">
      <TabsList aria-label="Project sections">
        <TabsTrigger value="overview">Overview</TabsTrigger>
        <TabsTrigger value="activity">Activity</TabsTrigger>
      </TabsList>
      <TabsContent value="overview">A short project summary.</TabsContent>
      <TabsContent value="activity">Recent changes and events.</TabsContent>
    </Tabs>
  );
}

Use a stable value for each tab and panel. The root can be uncontrolled with defaultValue or controlled with value and onValueChange.

Admin example

This data-only admin surface composes Tabs, Card, Badge, Input, Tooltip, IconButton, and Button without adding a backend or hiding actions behind hover.

Active projects

18

Events this week

4,280

Pending invites

7

A small administration screen using the Phase 4 component set.

API

Component API
PropTypeDefaultDescriptionConstraints
defaultValue / valueTabsTab.Valuefirst enabled tabUncontrolled or controlled active tab.Do not switch control models after mount.
onValueChange(value, eventDetails) => voidCalled when a tab changes by pointer or keyboard.Use it to coordinate surrounding state, not to duplicate active state.
orientation"horizontal" | "vertical""horizontal"Tab list direction and arrow-key axis.Match the visual layout and label the list.
TabsListList propsGroups tab triggers and manages roving focus.Provide an accessible label when the purpose is not visible.
TabsTrigger / TabsContentTab and panel propsPairs a value with its panel.Use matching values and keep panel content meaningful.

Tokens

Component tokens
TokenRoleEffective valueUsage
--size-control-smTab density1.75remKeeps the tab list compact while preserving focus visibility.
--color-bg-surface / --color-bg-subtleActive statesemantic surfacesActive tabs separate from the list without relying on color alone.
--focus-ring-*Keyboard focusshared focusRoving tab focus remains visible.

Accessibility

  • Use Arrow Left/Right (or Up/Down for vertical tabs) to move between tabs and Enter/Space when activation on focus is disabled.
  • Ensure the active tab and its panel are linked by the primitive; do not render a panel with a mismatched value.
  • Keep tab labels concise and do not use tabs for a single action or unrelated navigation.

Do and don’t

Do

Use tabs for genuinely peer views and keep the current subject in place.

Don’t

Use a tab strip as a wizard, hide required content only on hover, or create a tab for one item.

  • Card provides the surface for a tab panel.
  • DropdownMenu is better for a compact action/choice list.
  • Accessibility documents keyboard and focus review.