Skip to main content

Tabs

A flexible tab navigation component for switching between related content panels. Supports 3 variants, 3 sizes, vertical orientation, icons, disabled states, and smooth spring-based animations.

Live Preview

Interact with the Tabs component in real time. Adjust variant, size, and orientation to see changes instantly.

This is the overview panel. It provides a high-level summary of your project, including key metrics and recent activity.
tsx
1<Tabs2items={items}3variant="underline"4size="md"5orientation="horizontal"6/>

Installation

Install the Aidash Components package using your preferred package manager.

$ pnpm add @aidash/components

Import

Import the Tabs component into your file.

tsx
import { Tabs } from '@/components/aidash/tabs';

Usage

The simplest way to use Tabs with an array of items and content.

This is the overview panel. It provides a high-level summary of your project, including key metrics and recent activity.
tsx
1const items = [2{ value: 'overview', label: 'Overview', content: <p>Overview content...</p> },3{ value: 'features', label: 'Features', content: <p>Features content...</p> },4{ value: 'changelog', label: 'Changelog', content: <p>Changelog content...</p> },5];6 7<Tabs items={items} />

Variants

Three visual variants for different contexts: underline, pills, and boxed.

Underline

This is the overview panel. It provides a high-level summary of your project, including key metrics and recent activity.

Pills

This is the overview panel. It provides a high-level summary of your project, including key metrics and recent activity.

Boxed

This is the overview panel. It provides a high-level summary of your project, including key metrics and recent activity.
tsx
1<Tabs items={items} variant="underline" />2<Tabs items={items} variant="pills" />3<Tabs items={items} variant="boxed" />
Tip
Use underline for page-level navigation, pills for filter-style selection, and boxed for compact segmented controls.

Sizes

Three sizes from small to large to fit any layout context.

Small

This is the overview panel. It provides a high-level summary of your project, including key metrics and recent activity.

Medium (default)

This is the overview panel. It provides a high-level summary of your project, including key metrics and recent activity.

Large

This is the overview panel. It provides a high-level summary of your project, including key metrics and recent activity.
tsx
1<Tabs items={items} size="sm" />2<Tabs items={items} size="md" />3<Tabs items={items} size="lg" />

Orientation

Switch between horizontal and vertical layouts for different UI patterns.

Horizontal (default)

This is the overview panel. It provides a high-level summary of your project, including key metrics and recent activity.

Vertical

This is the overview panel. It provides a high-level summary of your project, including key metrics and recent activity.
tsx
1<Tabs items={items} orientation="horizontal" />2<Tabs items={items} orientation="vertical" />

With Icons

Enhance tab labels with icons for improved visual recognition.

Underline with Icons

Welcome to the home dashboard. View your recent activity and quick actions here.

Pills with Icons

Welcome to the home dashboard. View your recent activity and quick actions here.

Boxed with Icons

Welcome to the home dashboard. View your recent activity and quick actions here.
tsx
1const items = [2{ value: 'home', label: 'Home', icon: <HomeIcon />, content: <p>...</p> },3{ value: 'profile', label: 'Profile', icon: <UserIcon />, content: <p>...</p> },4{ value: 'settings', label: 'Settings', icon: <SettingsIcon />, content: <p>...</p> },5{ value: 'notifications', label: 'Notifications', icon: <BellIcon />, content: <p>...</p> },6];7 8<Tabs items={items} />

Disabled State

Disable individual tabs to prevent user selection while keeping them visible.

Underline with Disabled Tabs

General settings for your account including display name and email.

Pills with Disabled Tabs

General settings for your account including display name and email.
tsx
1const items = [2{ value: 'general', label: 'General', content: <p>...</p> },3{ value: 'security', label: 'Security', icon: <LockIcon />, content: <p>...</p> },4{ value: 'billing', label: 'Billing', disabled: true },5{ value: 'admin', label: 'Admin', disabled: true },6];7 8<Tabs items={items} />

Controlled Mode

Use the value and onChange props to control the active tab externally.

Active tab:profile
Edit your profile details, bio, and social links.
tsx
1const [activeTab, setActiveTab] = useState('profile');2 3<Tabs4items={items}5value={activeTab}6onChange={setActiveTab}7/>8 9{/* External controls */}10<button onClick={() => setActiveTab('profile')}>Go to Profile</button>11<button onClick={() => setActiveTab('account')}>Go to Account</button>

Accessibility

Built-in accessibility features following WAI-ARIA Tabs pattern.

ARIA Roles

Uses role="tablist", role="tab", and role="tabpanel" with proper aria-selected, aria-controls, and aria-labelledby relationships.

Keyboard Navigation

Active tab receives tabIndex=0 while inactive tabs use tabIndex=-1, following the roving tabindex pattern for efficient keyboard navigation.

Orientation Support

The aria-orientation attribute is set automatically based on the orientation prop, so assistive technologies can adapt their navigation behavior.

Disabled State

Disabled tabs are marked with aria-disabled and are visually dimmed with reduced opacity. They cannot be activated via click.

tsx
1<div>2<div role="tablist" aria-orientation="horizontal">3  <button role="tab" aria-selected="true" tabIndex={0}4    aria-controls="panel-overview" id="tab-overview">5    Overview6  </button>7  <button role="tab" aria-selected="false" tabIndex={-1}8    aria-controls="panel-features" id="tab-features">9    Features10  </button>11</div>12<div role="tabpanel" id="panel-overview"13  aria-labelledby="tab-overview">14  ...content15</div>16</div>

API Reference

Complete list of props accepted by Tabs and TabItem.

TabsProps
PropTypeDefaultDescription
itemsTabItem[]Array of tab items to render
variant'underline' | 'pills' | 'boxed''underline'Visual style of the tab list
size'sm' | 'md' | 'lg''md'Size of the tab buttons
orientation'horizontal' | 'vertical''horizontal'Layout direction of the tab list
defaultValuestringInitial active tab (uncontrolled)
valuestringActive tab value (controlled)
onChange(value: string) => voidCallback when active tab changes
classNamestring''Additional CSS classes
PropTypeDefaultDescription
valuestringUnique identifier for the tab
labelstringDisplay text for the tab button
iconReactNodeIcon rendered before the label
disabledbooleanfalseDisable the tab from being selected
contentReactNodeContent rendered in the tab panel
Note
When value is provided, the component operates in controlled mode. You must handle state updates via the onChange callback. Without value, the component manages its own state internally using defaultValue.

Other components that work well alongside Tabs.