Documentation
Tabs

Tabs

A component to display content grouped into different sections. Only one section can be displayed at a time - the active tab panel. Each content section is independent and has a corresponding tab element, that when activated, makes the content visible.

Tabs can have horizontal or vertical layouts. To build Tabs, use:

  • Tab - the tappable element that sets active content to display.
  • TabList - an optional element to wrap all tab elements for styling purposes
  • TabPanel - the content section to show or hide, depending on the active tab.

Props

PropTypeDefaultDescription
activeId
String
|
Number

Selected tab index number or key string (for controlled state)

defaultId
String
|
Number

Default selected tab index number or key string (for uncontrolled state to load initially)

children
String
|
Number
|
Boolean
|
Function

Tab content (see example)

onChange
Function

Callback(event, activeId: string, lastId: string) whenever tab changes, where ids could be indices

rtl
Boolean

Whether to use Right-to-Left direction

vertical
Boolean

Whether to use vertical orientation for Tabs

forceRender
Boolean

Whether to always render all Tab Panels - can be set individually (useful for SEO indexing)

items
Array

Alternative way to define Tabs and Panels as a single array

tabListProps
Object

TabList props to pass

Examples

Horizontal Tabs

Tab Panel 1

Vertical Tabs with Unordered ID

Tab Panel A

Content Between Tabs
Before TabBetween TabAfter Tab

Tab Panel 1

Custom Tab Style with an Array of Items
Panel 2 - as Render Function
Controlled Tab State

Tab Panel C controlled