Tabs

Display one panel at a time, helping users switch between related views.

Overview

The Tabs component organises related content into separate panels. It is built on Base UI primitives and supports keyboard navigation, disabled tabs, animated indicators, optional separators, and URL-synced state.

Usage

import {
  Tabs,
  TabsContent,
  TabsList,
  TabsTrigger,
} from "@tilt-legal/cubitt-components/tabs";
<Tabs defaultValue="account">
  <TabsList>
    <TabsTrigger value="account">Account</TabsTrigger>
    <TabsTrigger value="settings">Settings</TabsTrigger>
    <TabsTrigger value="billing">Billing</TabsTrigger>
  </TabsList>
  <TabsContent value="account">Account content</TabsContent>
  <TabsContent value="settings">Settings content</TabsContent>
  <TabsContent value="billing">Billing content</TabsContent>
</Tabs>

Examples

Default

Line

Separator

Use TabsSeparator inside the default track to separate groups of tabs. The separator fades while the selected pill touches either side of it.

Sizes

Disabled

Animated Height

Combine tabs with AutoResize for smooth height transitions between tab panels.

URL State

This example syncs with the demo-tab URL parameter.

API Reference

Tabs

The root component for a tabbed interface.

PropTypeDefaultDescription
defaultValuestring—The default active tab when uncontrolled.
valuestring—The controlled active tab value.
onValueChange(value: string, eventDetails: ChangeEventDetails) => void—Callback fired when the active tab changes.
disabledbooleanfalseWhether all tabs are disabled.
classNamestring—Additional classes for the root.

URL State Props

PropTypeDefaultDescription
paramNamestring—URL parameter name for syncing the active tab.
paramValuestring—Controlled URL-state value.
onUrlValueChange(value: string) => void—Callback when the URL parameter value changes.
paramClearOnDefaultbooleantrueRemove the URL parameter when it matches the default value.
paramDebouncenumber—Debounce URL updates in milliseconds.
paramThrottlenumber—Throttle URL updates in milliseconds.

TabsList

Container for tab triggers.

PropTypeDefaultDescription
variant"default" | "line""default"Visual style. default uses the pill track; line uses an underline indicator.
size"sm" | "md" | "lg""md"Trigger size.
classNamestring—Additional classes for the list.

TabsTrigger

Interactive tab trigger.

PropTypeDefaultDescription
valuestring—The tab value.
disabledbooleanfalseWhether the trigger is disabled.
renderReactElement | function—Render as a custom element while preserving tab behavior.
nativeButtonbooleantrueSet to false when render outputs a non-button element.
classNamestring—Additional classes for the trigger.

TabsSeparator

Visual separator for grouped default tabs.

PropTypeDescription
classNamestringAdditional classes for the separator.

TabsContent

Tab panel content.

PropTypeDescription
valuestringThe tab value for the panel.
classNamestringAdditional classes for the panel.

On this page