Skip to main content

Tabs

StorybookView in Storybook

Explore interactive examples and all component variations in our Storybook.

The Tabs component provides an accessible way to organize content into multiple panels. Built on Radix UI, it supports keyboard navigation, focus management, and customizable sizing. Perfect for settings panels, dashboards, content organization, and any interface requiring multiple views.

Basic Usage

Content for Tab 1

This is the content for the first tab.

Different Sizes

Small

Small tab content

Large

Large tab content

Settings Panel

Profile Settings
Manage your profile information and preferences.

Controlled Tabs

Overview Dashboard

Get a high-level view of your application metrics and performance.

Current active tab: overview

Properties

Tabs

PropertyTypeDescription
defaultValuestringThe default active tab value (uncontrolled).
valuestringThe active tab value (controlled).
onValueChange(value: string) => voidCallback fired when the active tab changes.
orientation"horizontal" | "vertical"The orientation of the tabs. Default is "horizontal".
dir"ltr" | "rtl"The reading direction of the tabs.
activationMode"automatic" | "manual"Whether tabs are activated automatically on focus or manually.
classNamestringAdditional CSS classes for the tabs container.
childrenReactNodeThe tabs content (TabsList and TabsContent).

TabsList

PropertyTypeDescription
size"sm" | "md" | "lg" | "xl"The size of the tabs list. Default is "md".
classNamestringAdditional CSS classes for the tabs list.
childrenReactNodeThe tab triggers (TabsTrigger components).

TabsTrigger

PropertyTypeDescription
valuestringThe unique value that associates the trigger with content.
size"sm" | "md" | "lg" | "xl"The size of the tab trigger. Default is "md".
disabledbooleanWhether the tab trigger is disabled.
classNamestringAdditional CSS classes for the tab trigger.
childrenReactNodeThe trigger content (usually text or icons).

TabsContent

PropertyTypeDescription
valuestringThe unique value that associates the content with a trigger.
forceMountbooleanWhether to force mount the content.
classNamestringAdditional CSS classes for the tab content.
childrenReactNodeThe content to display when the tab is active.

Accessibility

The Tabs component includes comprehensive accessibility features:

  • Keyboard Navigation - Arrow keys navigate between tabs, Space/Enter activates tabs
  • Focus Management - Proper focus handling and visual indicators
  • ARIA Support - Full ARIA attributes for screen readers
  • Role Semantics - Proper tablist, tab, and tabpanel roles
  • Screen Reader Support - Tab states and content announced correctly
  • Disabled State - Proper handling of disabled tabs

Common Use Cases

The Tabs component is perfect for:

  • Settings Panels - Organize different configuration sections
  • Dashboard Views - Switch between different data views
  • Content Organization - Separate related content into logical groups
  • Form Sections - Break long forms into manageable sections
  • Navigation Menus - Create tabbed navigation interfaces
  • Product Details - Show specifications, reviews, and related info
  • User Profiles - Organize profile information into categories

Best Practices

  1. Clear Labels - Use descriptive and concise tab labels
  2. Logical Grouping - Group related content together
  3. Consistent Sizing - Use consistent tab sizes throughout your interface
  4. Default Selection - Always have a default active tab
  5. Loading States - Show loading indicators for async content
  6. Responsive Design - Consider mobile layouts and scrollable tabs
  7. Icon Usage - Use icons to enhance tab identification
  8. State Management - Use controlled tabs for complex state requirements