Skip to content
nexubDesign System
v12.7.0

Components · Navigation

Tabs

StableAdded v0.0.1

Layered content panels switched by tab triggers. Built on Radix UI Tabs.

import { Tabs } from '@nexub/react';
View as Markdown

Usage

Use it for
  • Switching between related views within the same page context

  • Organising content that belongs to the same entity

  • Reducing visual clutter by hiding secondary content behind tabs

  • Horizontal navigation within a bounded section

Use something else for
  • Global site navigation — use the sidebar or top nav

  • Sequential steps in order — use Stepper

  • Comparing content side-by-side — keep both views visible

  • More than 5–7 tabs — consider a Select or sub-navigation

Playground

Props

orientation
Overview content goes here.
TSX
<Tabs.Root defaultValue="tab1">…</Tabs.Root>

Examples

Default

Overview content goes here.

Vertical

orientation="vertical": the indicator slides on the inline-end edge, and arrow up/down move between tabs.

Name, photo and contact details.

Props

Props
PropTypeDefaultDescription
defaultValuestring—Initially active tab value (uncontrolled).
valuestring—Controlled active tab value.
onValueChange(value: string) => void—Callback when active tab changes.
orientation'horizontal' | 'vertical''horizontal'Layout direction of the tab list.

Design tokens

Tabs reads these component tokens. Each one is unset by default and falls back to the semantic role it aliases, so nothing changes until you set it. Set one on any element to restyle every Tabs below it, and leave the roles other components share alone. See the three token tiers.

Tabs design tokens
TokenAliasesNotes
--tabs-fg--color-on-surface-variant—
--tabs-active-fg--color-primaryLine variant; the pill variant keeps on-surface.
--tabs-indicator--color-primaryThe sliding bar of the line variant.
CSS
/* One area of your app */
.checkout {
  --tabs-fg: var(--color-secondary);
}