Tabs
A tabbed interface for organizing content into panels with support for icons, badges, keyboard navigation, and various visual variants.
Import
Usage
Examples
Variant
Content 1
Content 1
Content 1
Size
Content 1
Content 1
Content 1
Radius
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Content 1
Active tab styling
Content 1
With icons
Home content
With badges
Inbox content
Controlled
Content 1
Active tab: tab1
Uncontrolled with default
Content 2
Disabled tabs
Active content
Full width
Content 1
Custom tab styling
Content 1
Per-tab active styling
Primary content
Props
| Prop | Type | Default | Description |
|---|---|---|---|
tabs | TabItem[] | None | Tab definitions (required) |
activeId | string | number | None | Controlled active tab ID |
defaultActiveId | string | number | None | Default active tab ID |
onChange | (id: string | number) => void | None | Callback when tab changes |
variant | "underline" | "bordered" | "ghost" | "underline"* | Visual style |
size | "sm" | "md" | "lg" | "md"* | Size scale |
radius | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full" | "md"* | Tablist corner rounding |
activeRadius | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full" | "md"* | Active tab corner rounding |
activeVariant | "solid" | "ghost" | "bordered" | "faded" | "underlined" | "solid"* | Active tab variant |
activeColor | "none" | "default" | "primary" | "secondary" | "danger" | "warning" | "success" | "primary"* | Active tab color |
fullWidth | boolean | false | Stretch tabs to full width |
tabListClassName | string | None | Extra classes for tablist |
tabClassName | string | None | Extra classes for each tab |
tabPanelClassName | string | None | Extra classes for content panel |
className | string | None | Extra classes, merged with internal styles |
* Falls back through Global Configuration if not set. See below.
TabItem
| Prop | Type | Description |
|---|---|---|
id | string | number | Unique identifier (required) |
label | ReactNode | Display label (required) |
name | ReactNode | Alias for label |
content | ReactNode | Panel content (required) |
icon | ReactNode | Leading icon |
badge | ReactNode | Badge or count |
disabled | boolean | Disables tab |
activeVariant | Variant | Per-tab active variant override |
activeColor | Color | Per-tab active color override |
Global Configuration
Tabs reads defaults from four places, in this order of precedence:
- Instance prop: set directly on
<Tabs /> - Component config:
components.tabsin yourashee.config - Theme default:
defaultColor/defaultRadiusin yourashee.config - Built-in fallback: component's internal default values
Component config
Built-in fallbacks
Accessibility
- Uses proper ARIA roles:
tablist,tab,tabpanel - Uses
aria-selectedto indicate active tab - Uses
aria-controlsandaria-labelledbyfor associations - Supports keyboard navigation with Arrow Left/Right, Home, and End keys
- Disabled tabs are skipped in keyboard navigation
- Focus management for active tab
- Implements
focus-visiblerings for keyboard navigation
Notes
- Controlled vs Uncontrolled: Use
activeId/onChangefor controlled usage, ordefaultActiveIdfor uncontrolled. - Per-tab Overrides: Each tab can override the active variant and color using
activeVariantandactiveColorproperties. - Variant Behavior:
underlineshows an underline indicator,borderedwraps tabs in a bordered container,ghostuses minimal styling with gaps. - Full Width: When
fullWidthistrue, tabs stretch to fill the container width evenly. - Badges: Badges are rendered as small rounded indicators next to tab labels.
- Disabled Tabs: Disabled tabs cannot be focused or selected and are skipped during keyboard navigation.