1. Documentation
  2. Navigation
  3. Tabs
ReadmenpmGitHub
  • Introduction
  • Installation
  • Theming
  • Icons
  • Accordion
  • Card
  • Scroll Area
  • Separator
  • Sidebar
  • Field
  • Label
  • Input
  • Textarea
  • Number Field
  • OTP Field
  • Select
  • Combobox
  • Checkbox
  • Radio
  • Switch
  • Slider
  • Toggle
  • Calendar
  • Date Picker
  • File Upload
  • Button
  • Copy Button
  • Dropdown
  • Command
  • Tabs
  • Breadcrumb
  • Pagination
  • Tree
  • Table
  • Data Table
  • Stat
  • Timeline
  • Avatar
  • Status Bar
  • Badge
  • Meter
  • Empty
  • Skeleton
  • Spinner
  • Toast
  • Dialog
  • Sheet
  • Popover
  • Tooltip
  • Text
  • Kbd
  • Code Block
  • Utilities
  • Design rules

Tabs

Three shapes of tab list, each with a moving indicator rendered for you.

Loading documentation…

Command< PreviousBreadcrumbNext >

Powered by heyo

On this page

UsageVariantsIcons and disabled tabsComposedPropertiesTabsTabs.ListTabs.Tab, Tabs.Panel, Tabs.Indicator

142,318 requests this month.

<Tabs defaultValue="overview"><Tabs.List  items={[    { value: "overview", label: "Overview" },    { value: "logs", label: "Logs" },    { value: "settings", label: "Settings" },  ]}/><Tabs.Panel value="overview">142,318 requests this month.</Tabs.Panel><Tabs.Panel value="logs">Nothing in the last hour.</Tabs.Panel><Tabs.Panel value="settings">Two environment variables.</Tabs.Panel></Tabs>

Tabs switch what is displayed, in place. The moving highlight is pure CSS — Base UI publishes the active tab's geometry as custom properties, so there is no measuring in React and no resize observer.

Tabs.List renders its own indicator. You never place Tabs.Indicator yourself unless you want it somewhere unusual.

Usage

tsx
import { Tabs } from "@heyo-sh/heyo-ui";<Tabs defaultValue="overview">  <Tabs.List items={tabs} />  <Tabs.Panel value="overview">…</Tabs.Panel></Tabs>;

Variants

linedefaultoptional

A rule runs the full width and the indicator sits on it. The default for page-level navigation.

underlinevariantoptional

Padded tabs that highlight on hover, with the indicator detached below a hairline.

segmentedvariantoptional

A pill that slides between tabs inside a recessed track. The selected pill is the indicator, so there is nothing else to place.

<Tabs defaultValue="overview" variant="line"><Tabs.List items={items} /></Tabs><Tabs defaultValue="overview" variant="underline"><Tabs.List items={items} /></Tabs><Tabs defaultValue="overview" variant="segmented"><Tabs.List items={items} /></Tabs>

Icons and disabled tabs

<Tabs defaultValue="code"><Tabs.List  items={[    { value: "code", label: "Code", icon: IconCode },    { value: "preview", label: "Preview", icon: IconBrowser },    { value: "deploy", label: "Deploy", icon: IconRocket, disabled: true },  ]}/></Tabs>

Composed

Write the tabs out when a row needs more than a label — a count, a status dot, a router link.

<Tabs defaultValue="open"><Tabs.List>  <Tabs.Tab value="open">    Open    <Badge variant="count">12</Badge>  </Tabs.Tab>  <Tabs.Tab value="closed">Closed</Tabs.Tab></Tabs.List></Tabs>
Tabs or Toggle?

Tabs change what is shown. A ToggleGroup changes how the same thing is shown — grid or list, day or week.

Properties

Tabs

variant"line" | "underline" | "segmented"optional

The shape of the list. It defaults to line.

value / defaultValuestringoptional

Controlled and uncontrolled selection.

onValueChange(value: string) => voidoptional

Fires when a tab is selected.

orientation"horizontal" | "vertical"optional

The axis. It defaults to horizontal.

Tabs.List

itemsTabItem[]optional

Shorthand: { value, label, icon?, disabled? } per tab.

indicatorbooleanoptional

The moving highlight, rendered for you. Pass false only to place Tabs.Indicator somewhere unusual yourself.

Tabs.Tab, Tabs.Panel, Tabs.Indicator

valuestringrequired

Ties a tab to its panel.

disabledbooleanoptional

Dims a tab and ignores interaction.

childrenReactNodeoptional

Tabs.Panel holds the content for its value. Tabs.Indicator takes no children — it is the moving highlight.