Tabs

A tabbed navigation component with animated active indicators. Supports underline and pills visual variants, controlled and uncontrolled modes, disabled tabs, and responsive horizontal scrolling on mobile.

Import

import { Tabs, TabsPanel } from '@wavebooking/aqua-fusion';

Preview

Loading preview...

Usage

<Tabs
  tabs={[
    { key: 'overview', label: 'Overview' },
    { key: 'details', label: 'Details' },
    { key: 'reviews', label: 'Reviews' },
  ]}
  defaultTab="overview"
  onTabChange={(tab) => console.log(tab)}
/>

Pills variant

<Tabs
  tabs={[
    { key: 'all', label: 'All' },
    { key: 'active', label: 'Active' },
    { key: 'archived', label: 'Archived', disabled: true },
  ]}
  variant="pills"
  size="sm"
/>

With panel content

const [activeTab, setActiveTab] = useState('tab1');

<Tabs
  tabs={[
    { key: 'tab1', label: 'Tab 1' },
    { key: 'tab2', label: 'Tab 2' },
  ]}
  activeTab={activeTab}
  onTabChange={setActiveTab}
/>
{activeTab === 'tab1' && <TabsPanel>Content for Tab 1</TabsPanel>}
{activeTab === 'tab2' && <TabsPanel>Content for Tab 2</TabsPanel>}

Props

Tabs

PropTypeDefaultDescription
tabs*TabItem<T>[]-Array of tab items, each with key, label, and optional disabled flag.
defaultTabT-Initially active tab key (uncontrolled).
activeTabT-Controlled active tab key.
onTabChange(tab: T) => void-Callback when the active tab changes.
variant'underline' | 'pills''underline'Visual style of the tab indicators.
size'sm' | 'md' | 'lg''md'Size of the tab buttons.
fullWidthbooleanfalseWhether tabs stretch to fill the full container width.
classNamestring-Additional CSS class for the outer wrapper.
tabListClassNamestring-Additional CSS class for the tab list nav element.

TabItem

PropTypeDefaultDescription
key*string-Unique identifier for the tab.
label*string-Display text for the tab button.
disabledboolean-Whether the tab is disabled and not clickable.

TabsPanel

PropTypeDefaultDescription
children*ReactNode-Panel content.
classNamestring-Additional CSS class for the panel wrapper.