Tabs organize content into separate panels, with only one visible at a time.
Basic Usage
import { Tabs, TabList, Tab, TabPanel } from "@paramanu/navigation-react"
export default function App() {
<TabPanel>Content</TabPanel>
<div class="pm-tabs pm-tabs--line pm-tabs--md pm-tabs--horizontal">
<div class="pm-tabs__list" role="tablist">
<button class="pm-tabs__tab pm-tabs__tab--active" role="tab" aria-selected="true">Tab 1</button>
<button class="pm-tabs__tab" role="tab" aria-selected="false" tabindex="-1">Tab 2</button>
<div class="pm-tabs__panel" role="tabpanel" tabindex="0">Content</div>
Variants
Supports "line", "enclosed", and "pill" variants.
Accessibility
| Key | Action |
|---|
ArrowRight / ArrowLeft | Move between tabs (horizontal) |
ArrowDown / ArrowUp | Move between tabs (vertical) |
Enter / Space | Activate focused tab |
Home | Move to first tab |
End | Move to last tab |
- Uses
role="tablist", role="tab", and role="tabpanel".
- Active tab has
aria-selected="true" and tabIndex={0}.
- Inactive tabs have
tabIndex={-1}.
Tabs Props
| Prop | Type | Default | Description |
|---|
variant | "line" | "enclosed" | "pill" | "line" | Visual variant |
size | "sm" | "md" | "lg" | "md" | Size preset |
orientation | "horizontal" | "vertical" | "horizontal" | Layout direction |
fitted | boolean | false | Fill container width |
Tab Props
| Prop | Type | Default | Description |
|---|
active | boolean | false | Selected state |
disabled | boolean | false | Disabled state |
CSS Classes
| Class | Description |
|---|
pm-tabs | Root element |
pm-tabs--pill | Pill variant |
pm-tabs--fitted | Fitted layout |
pm-tabs__list | Tab list |
pm-tabs__tab | Individual tab |
pm-tabs__tab--active | Active tab |
pm-tabs__panel | Content panel |