Skip to documentation

Design system / Molecules

Molecule / Navigation

Tabs

Tabs links a trigger list to related content panels through matching values. Radix manages selection unless the caller controls it. Panel lifecycle and product workflows require explicit consumer decisions.

Live example

Live preview

Current component with fictional data. Example changes are not persisted.

Sample details panel.

Responsibility

The list, triggers and matched panels form one selection contract. Tab contents retain their own responsibilities. A page coordinating workflows across tabs is classified separately from this molecule.

Public contract

The table describes supported inputs, exported parts and caller responsibilities. A callback supplies a command, such as saving a draft. These notes are maintained manually; check current source types before integration.

Maintained component API notes; current source is authoritative
Prop / partTypeRequirementResponsibility
value / defaultValue / onValueChangeRadix root propsControlled or uncontrolledBind selection externally, or let Radix own the initial/local value.
orientationhorizontal | verticalOptional · default horizontalRoot orientation affects structure and keyboard semantics.
variantdefault | lineTabsList only · default defaultList appearance; not a root variant prop.
value / disabledRadix trigger propsValue required; disabled optionalEach trigger identifies a panel; disabled prevents selection.
value / forceMountRadix content propsValue required; forceMount optionalPanel identity and lifecycle. Forced mounting needs an intentional inactive visibility policy.

API notes are curated documentation, not generated types. The source linked above is the current implementation; update these notes alongside API changes.

State and behavior

Identify which values the caller controls and which behavior the component or underlying primitive owns. A local example does not supply persistence, authorization or a complete product lifecycle.

Radix owns selection when uncontrolled; value/onValueChange delegate it to a consumer. ProgramSetupTab owns section state. Selection does not fetch data, authorize content, synchronize a URL or persist form state automatically.

Dependencies

  • Radix Tabs Root, List, Trigger and Content
  • cva tabsListVariants
  • cn

Token and styling contract

These notes identify theme roles, utilities and direct style values used by the source. Direct colors or timings are implementation exceptions, not recommendations to bypass the theme.

bg-muted / text-muted-foreground
Default tab list surface.
bg-background / text-foreground
Active trigger roles.
border-ring / ring-ring
Focus styling inherited by triggers.
text-md, rounded-lg, gap-2
Type and root/list geometry; line variant exposes an active indicator.

Boundaries and limitations

  • List variant is not a Tabs root prop.
  • Panel mounting and form-state preservation require an explicit decision; default selection alone does not guarantee retained drafts.

Where to make a change

Change generic tab styling in tabs.tsx; change labels and values in ProgramSetupNavigation; change state, persistence and panel workflows in their owning consumer. Coordinate value renames across triggers, content and controlled state.

Selected real uses

ProgramSetupNavigation

Supplies three product-specific tab values and a line-style list. It does not own the selected value.

Repository path: src/components/programs/programSetupNavigation.tsx

ProgramSetupTab

Controls the selected section and force-mounts its panels, hiding inactive ones so their local lifecycle is retained.

Repository path: src/app/(tenants)/console/[tenantCode]/admin/programs/[programCode]/program-setup-tab.tsx

These traces describe selected uses, not every dependency. Repository-only paths are shown as references; only approved files have public source views.

Usage contract

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

<Tabs defaultValue="details">
  <TabsList aria-label="Record sections" variant="line">
    <TabsTrigger value="details">Details</TabsTrigger>
    <TabsTrigger value="settings">Settings</TabsTrigger>
  </TabsList>
  <TabsContent value="details">{details}</TabsContent>
  <TabsContent value="settings">{settings}</TabsContent>
</Tabs>

Illustrative consumer bindings, not a self-contained product workflow. Live examples supply only local state or explicit fictional props.

All molecules
Current components and theme tokens. Fictional example data. Source views refresh on deployment; authors maintain contract notes.