ComponentCompound

Tabs

A tabbed interface with compound components, ARIA support, and keyboard navigation. Uses the headless @refraction-ui/tabs core.

Live Example

A realistic settings page with account, notification, and billing tabs.

Account Settings

Manage your account details and preferences.

Jane Cooper
jane@example.com
Admin

Installation

$pnpm add @refraction-ui/react-tabs

Usage

tsx
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@refraction-ui/react'

export function MyTabs() {
  return (
    <Tabs defaultValue="overview">
      <TabsList>
        <TabsTrigger value="overview">Overview</TabsTrigger>
        <TabsTrigger value="features">Features</TabsTrigger>
        <TabsTrigger value="api">API</TabsTrigger>
      </TabsList>
      <TabsContent value="overview">
        <p>Overview content here.</p>
      </TabsContent>
      <TabsContent value="features">
        <p>Features content here.</p>
      </TabsContent>
      <TabsContent value="api">
        <p>API reference here.</p>
      </TabsContent>
    </Tabs>
  )
}

Tabs Props

PropTypeDefaultDescription
valuestring--Controlled active tab value.
defaultValuestring''Initial tab for uncontrolled usage.
onValueChange(value: string) => void--Callback when the active tab changes.
orientation'horizontal' | 'vertical''horizontal'Orientation of the tab list.
classNamestring--Additional CSS classes on the root element.

Compound Components

PropTypeDefaultDescription
TabsListHTMLAttributes<HTMLDivElement>--Container for tab triggers with role="tablist".
TabsTriggerButtonHTMLAttributes & { value: string }--Tab button. The value prop links it to its content panel.
TabsContentHTMLAttributes<HTMLDivElement> & { value: string }--Tab panel. Only renders when its value matches the active tab.