Skip to main content

Overview

The Tabs component provides a way to organize related content into separate views that users can switch between. It features an animated indicator and supports icons, making it suitable for various navigation and content organization needs.

Use cases

  • Organize related content into logical sections
  • Create settings panels with multiple categories
  • Display different data views (e.g., table vs. chart)
  • Build multi-step forms with navigation
  • Show code examples in different languages
  • Implement document editors with multiple tabs

Anatomy

The Tabs component consists of:
  • Tabs - Root container that manages tab state
  • Tabs.List - Container for tab triggers with animated indicator
  • Tabs.Tab - Individual tab trigger button
  • Tabs.Content - Content panel associated with a tab

Props

Tabs (root)

Inherits all props from the Base UI Tabs.Root component.
string | number
The value of the tab that should be active by default.
string | number
The controlled value of the active tab. Use with onValueChange for controlled behavior.
(value: string | number) => void
Callback fired when the active tab changes.
'horizontal' | 'vertical'
default:"'horizontal'"
The orientation of the tabs.
string
Additional CSS class names to apply to the tabs container.

Tabs.List

Inherits all props from the Base UI Tabs.List component.
string
Additional CSS class names to apply to the tab list.

Tabs.Tab

string | number
required
The unique value that identifies this tab.
ReactNode
Icon to display before the tab label.
boolean
default:"false"
When true, the tab cannot be activated.
string
Additional CSS class names to apply to the tab trigger.

Tabs.Content

string | number
required
The value of the tab that this content is associated with.
string
Additional CSS class names to apply to the content panel.

Usage

Basic tabs

Tabs with icons

Controlled tabs

Disabled tabs

Code example tabs

Tabs with dynamic content

Settings panel with tabs

Accessibility

  • Built on Base UI Tabs primitive with full ARIA support
  • Keyboard navigation:
    • Arrow keys to navigate between tabs
    • Home/End keys to jump to first/last tab
    • Tab key to move focus into content panel
  • Automatic role="tablist", role="tab", and role="tabpanel" attributes
  • Proper aria-selected state on active tabs
  • aria-controls links tabs to their content panels
  • aria-labelledby links content panels to their tabs
  • Disabled tabs are marked with aria-disabled
  • Focus management follows WAI-ARIA Tabs pattern

Styling customization

Customize tabs using className props:
The component includes an animated indicator that automatically moves to highlight the active tab. This is handled internally through CSS modules and does not require additional configuration.