TabsUpdated
Tabs organize content into multiple sections and allow users to navigate between them.
Import
import { Tabs } from '@heroui/react';Usage
Overview
Analytics
Reports
View your project overview and recent activity.
import {Tabs} from "@heroui/react";
export function Basic() {
return (
<Tabs className="w-full max-w-md">Anatomy
Import the Tabs component and access all parts using dot notation.
import { Tabs } from '@heroui/react';
export default () => (
<Tabs>
<Tabs.ListContainer>
<Tabs.List aria-label="Options">
<Tabs.Tab>
<Tabs.Indicator />
</Tabs.Tab>
</Tabs.List>
</Tabs.ListContainer>
<Tabs.Panel/>
</Tabs>
)Vertical
Account
Security
Notifications
Billing
Account Settings
Manage your account information and preferences.
import {Tabs} from "@heroui/react";
export function Vertical() {
return (
<Tabs className="w-full max-w-lg" orientation="vertical">Disabled Tab
Active
Disabled
Available
This tab is active and can be selected.
import {Tabs} from "@heroui/react";
export function Disabled() {
return (
<Tabs className="w-full max-w-md">Custom Styles
Daily
Weekly
Bi-Weekly
Monthly
import {Tabs} from "@heroui/react";
export function CustomStyles() {
return (
<Tabs className="w-full max-w-lg text-center">Styling
Passing Tailwind CSS classes
import { Tabs } from '@heroui/react';
function CustomTabs() {
return (
<Tabs className="w-full max-w-lg text-center">CSS Classes
The Tabs component uses these CSS classes:
Base Classes
.tabs- Base tabs container.tabs__list-container- Tab list container wrapper.tabs__list- Tab list container.tabs__tab- Individual tab button.tabs__panel- Tab panel content.tabs__indicator- Tab indicator
Orientation Attributes
.tabs[data-orientation="horizontal"]- Horizontal tab layout (default).tabs[data-orientation="vertical"]- Vertical tab layout
Interactive States
The component supports both CSS pseudo-classes and data attributes:
- Selected:
[aria-selected="true"] - Hover:
:hoveror[data-hovered="true"] - Focus:
:focus-visibleor[data-focus-visible="true"] - Disabled:
[aria-disabled="true"]
API Reference
Tabs Props
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | "horizontal" | "vertical" | "horizontal" | Tab layout orientation |
hideSeparator | boolean | false | Hide separator lines between tabs |
selectedKey | string | - | Controlled selected tab key |
defaultSelectedKey | string | - | Default selected tab key |
onSelectionChange | (key: Key) => void | - | Selection change handler |
className | string | - | Additional CSS classes |
Tabs.List Props
| Prop | Type | Default | Description |
|---|---|---|---|
aria-label | string | - | Accessibility label for tab list |
className | string | - | Additional CSS classes |
Tabs.Tab Props
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | - | Unique tab identifier |
isDisabled | boolean | false | Whether tab is disabled |
className | string | - | Additional CSS classes |
Tabs.Panel Props
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | - | Panel identifier matching tab id |
className | string | - | Additional CSS classes |