Tabs

Display one panel at a time, helping users switch between different views or subsections.

Overview

The Tabs component organises related content into separate panels that users can switch between, providing an efficient way to present multiple views or sections within the same interface area. Built on Base UI primitives, it offers full keyboard navigation and accessibility features.

Usage

import {
  Tabs,
  TabsList,
  TabsTrigger,
  TabsContent,
} from "@tilt-legal/cubitt-components/primitives";
<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

With Separator

Use TabsSeparator inside the default track when you need a visual split between groups of tabs. The separator fades out while the selected pill touches either side of it, then reappears once the indicator moves away.

Sizes

Disabled

Animated Height

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

URL State

This example syncs with the URL parameter "demo-tab". Try switching tabs and refreshing the page or sharing the URL.

API Reference

Tabs

The root component for creating tabbed interfaces with multiple variants and sizes.

PropTypeDefaultDescription
defaultValuestringThe default active tab when uncontrolled.
valuestringThe controlled active tab value.
onValueChange(value: string) => voidCallback fired when the active tab changes.
disabledbooleanfalseWhether all tabs are disabled.
classNamestringAdditional CSS classes for the tabs container.

URL State Props

When provided with a paramName, the tabs will sync their state with URL parameters via TanStack Router search params.

PropTypeDefaultDescription
paramNamestringURL parameter name for syncing state with URL. Enables URL state management.
onUrlValueChange(value: string) => voidCallback when URL parameter value changes.
paramClearOnDefaultbooleantrueRemove URL param when value equals default.
paramDebouncenumberDebounce URL updates in milliseconds.
paramThrottlenumberThrottle URL updates in milliseconds.

TabsList

Container for tab triggers with variant and size controls.

PropTypeDefaultDescription
variant"default" | "line""default"The visual variant of the tabs list. default uses the segmented control styling.
size"sm" | "md" | "lg""md"The size of the tabs.
classNamestringAdditional CSS classes for the tabs list.

TabsTrigger

Individual tab trigger that users click to switch panels. Supports Base UI's polymorphic render prop for custom elements such as router links.

PropTypeDefaultDescription
valuestringThe value of the tab trigger (required).
disabledbooleanfalseWhether the tab trigger is disabled.
renderReactElement | functionRender the trigger as a custom element or component while preserving tab state.
nativeButtonbooleantrueSet to false when render outputs a non-button element like Link or a.
classNamestringAdditional CSS classes for the tab trigger.

TabsContent

The content panel for each tab.

PropTypeDescription
valuestringThe value of the tab content (required).
classNamestringAdditional CSS classes for the tab content.

On this page