Tabs

Use Tabs to display a list of tabs with associated content panels.

Ready to use
import {Tabs} from '@primer/react-brand'

Examples

Default

Loading

Accent variant

Loading

Underline variant

Loading

Custom panels

Loading

Start alignment

Loading

Custom default active tab

Loading

Component props

Tabs Required

nametypedefaultrequireddescription
childrenReactNodeundefinedtrueNamed children to be rendered as tab items and panels. Must include Tabs.Item, and optionally Tabs.Panel components
aria-labelstringundefinedtrueAccessible label for the tab list element, used by screen readers to describe the tab group
variant'default' | 'accent' | 'underline''default'falseVisual style variant of the tabs. Affects the appearance and styling theme
align'start' | 'center''center'falseHorizontal alignment of the tab navigation
defaultActiveTabstring'0'falseSets the default active tab. “0” (first tab) by default
onChange(activeTab: string) => voidundefinedfalseCallback function triggered when the active tab changes. Receives the new active tab identifier
classNamestringundefinedfalseAdditional CSS class names to apply to the tabs container for custom styling
internalAccessibleLabelsobjectundefinedfalseCustomizable aria-label values for screen readers to improve accessibility. Defaults to English.
internalAccessibleLabels
.controlsNext
string'Next tab'falseLabel for the “next tab” control button, used by screen readers
internalAccessibleLabels
.controlsPrev
string'Previous tab'falseLabel for the “previous tab” control button, used by screen readers

Forwards all standard HTML attributes for <div> elements.

Tabs.Item Required

Individual tab item that users can click to switch between panels.

nametypedefaultrequireddescription
childrenReactNodeundefinedtrueContent to be displayed inside the tab button
classNamestringundefinedfalseSets a custom class on the tab button element

Forwards all standard HTML attributes for <button> elements.

Tabs.Panel

Content panel associated with each tab. Hidden when not active.

nametypedefaultrequireddescription
childrenReactNodeundefinedtrueContent to be displayed inside the panel
animation'slide-in-up' | 'scale-in-up' | 'fade-in' | falsefalsefalseOptional animation when the panel becomes active
classNamestringundefinedfalseSets a custom class on the panel element

Forwards all standard HTML attributes for <div> elements.