Color
Typography
Spacing
Radius
Border
Opacity
Elevation
Blur
Avatar
Badge
Button
Checkbox
Input
ProgressBar
RadioButton
Separator
Slider
Switch
TextArea
TextLink
Accordion
Breadcrumb
ButtonGroup
Combobox
DropdownMenu
ListItem
Pagination
SegmentedControl
Select
Tooltip
Calendar
Card
CommandMenu
DatePicker
Dialog
Drawer
EmptyState
Footer
Form
NavigationBar
Sidebar
Skeleton
Table
Tabs
Toaster

Tabs

Switches between views of related content: a bar of tabs, and the panel of the selected one.

Content of Tab 1.
Size

Usage

Import the component and render it.

import { Tabs } from 'src/components/Tabs/Tabs';
import { HouseLineIcon } from '@phosphor-icons/react';

<Tabs
  size="sm"
  items={[{"value":"tab-1","label":"Tab 1","icon":<HouseLineIcon />,"content":"Content of Tab 1."},{"value":"tab-2","label":"Tab 2","icon":<HouseLineIcon />,"content":"Content of Tab 2."},{"value":"tab-3","label":"Tab 3","icon":<HouseLineIcon />,"content":"Content of Tab 3."}]}
  label="Sections"
/>

Accessibility

Role: tablist (named by label) with tabs and one tabpanel, labelled by its tab.

KeyAction
TabMoves focus to the selected tab, then into the panel content
Arrow Left / RightSelects the previous / next enabled tab (wraps around)
Home / EndSelects the first / last enabled tab
  • Only the selected tab is in the Tab order (roving tabindex); the arrow keys select as they move, since panels show instantly.
  • The panel is not focusable itself (no focus style is designed for it): put the content’s own controls or text in it.

Size

Set the size prop: Small is "sm", Large is "lg".

Content of Tab 1.
Small
Content of Tab 1.
Large
<Tabs
  size="sm"
  items={[{"value":"tab-1","label":"Tab 1","icon":<HouseLineIcon />,"content":"Content of Tab 1."},{"value":"tab-2","label":"Tab 2","icon":<HouseLineIcon />,"content":"Content of Tab 2."},{"value":"tab-3","label":"Tab 3","icon":<HouseLineIcon />,"content":"Content of Tab 3."}]}
/>
<Tabs
  size="lg"
  items={[{"value":"tab-1","label":"Tab 1","icon":<HouseLineIcon />,"content":"Content of Tab 1."},{"value":"tab-2","label":"Tab 2","icon":<HouseLineIcon />,"content":"Content of Tab 2."},{"value":"tab-3","label":"Tab 3","icon":<HouseLineIcon />,"content":"Content of Tab 3."}]}
/>

Composition

Use the following composition to build a Tabs:

Tabs
└── Tab

Tab

One tab of a Tabs bar: an optional leading icon and a label (or icon only). Only used inside Tabs.

Tab
<Tab label="Tab" />

Actions

Pass callbacks to respond to the component.

import { Tabs } from 'src/components/Tabs/Tabs';
import { HouseLineIcon } from '@phosphor-icons/react';

<Tabs
  size="sm"
  items={[{"value":"tab-1","label":"Tab 1","icon":<HouseLineIcon />,"content":"Content of Tab 1."},{"value":"tab-2","label":"Tab 2","icon":<HouseLineIcon />,"content":"Content of Tab 2."},{"value":"tab-3","label":"Tab 3","icon":<HouseLineIcon />,"content":"Content of Tab 3."}]}
  label="Sections"
  onValueChange={(value) => console.log(value)}
/>
CallbackWhen
onValueChangeCalled when another tab is selected.