Skip to main content

Tabs

Usage

Definition

Tabs organize content within a category in a horizontal menu of logical subsections.

Each tab within a group contains a distinct subsection of content.

Common Characteristics

All tabs are presented horizontally and have ALL-CAPS labels. All tabs have a separator that spans the width of the content area governed by the tabs. Tabs have these states: selected, active, hover/tap, and focused. A Tab with no content must have explanatory text rather than left blank.

Usage Guidelines

The left-most tab is always pre-selected by default. Content within tabs must be peers related to the same parent category/topic/item. If necessary, tabs can scroll horizontally above the content they govern.

Tabs can scroll above the content if needed. Tabs with no content must have explanatory text. Click the second tab for an example.

Design

States

Tabs have these states: selected, active, hover/tap, and focused.

Tabs are left aligned with a visual separator that spans the width of the content governed by the tabs.

SCSS

Modifiers

NameDescription
tab-light-bkgTabs on a Light Background
tab-dark-bkgTabs on a Dark Background
tab-icon-light-bkgIcon Tab Bar (TOP) on a Light Background
tab-icon-dark-bkgIcon Tab Bar (TOP) on a Dark Background
tab-icon-light-bkg-bottomIcon Tab Bar (BOTTOM) on a Light Background
tab-icon-dark-bkg-bottomIcon Tab Bar (BOTTOM) on a Dark Background

Code

Tabs

Props on the Tabs component will apply to the entire collection. Props on the TabPane will cascade to the Tab component and the underlying Action component.

Tabs can have label and icons

Live Editor
Result
Loading...

Tabs can have either label and icons

Live Editor
Result
Loading...
Live Editor
Result
Loading...

Tabs can set textOnly or iconOnly

Live Editor
Result
Loading...
Live Editor
Result
Loading...

Tab Active

The active tab is set to zero (0) by default and can be set to any tab index.

Live Editor
Result
Loading...

Tab Color

Tabs can be used on light backgrounds

Live Editor
Result
Loading...

Tabs can be used on dark backgrounds

Live Editor
Result
Loading...

Tab Border

Tabs can be used with a border below the tabs

Tabs has a bottom border by default. This is controlled by a boolean property border

Live Editor
Result
Loading...

Tabs can be used without a border below the tabs

This is often used when using a dark background color.

Live Editor
Result
Loading...

Tabs use Buttons under the hood allowing for an href to be provided as a link to an external page.

Live Editor
Result
Loading...

Tab content updates with changes

Live Editor
Result
Loading...

Tab generated from data prop

Live Editor
Result
Loading...

Tab generation from data prop can be dynamic

Live Editor
Result
Loading...

Tab Props

Tabs

NameTypeDefaultDescription
activeIndexnumber0Sets the currently selected tab index (the first tab's index is zero (0))
borderbooltrueToggles the border below the tab buttons
classNamestringString of classnames to add to the Tabs container
color"light" or "dark""light"Sets color state of tabs. Must be either "light" or "dark"
dataarray[dataShape]nullAllows for tab construction via an object
iconOnlyboolSets the tab buttons to display only icon provided
idstringuuid()String used as the id attribute of the Tabs container
onChangefuncCallback function for when the activeIndex is modified. Sends an object containing prevActiveIndex and activeIndex.
size"sm" or "md""md"Sets the display size of the tabs. Must be either "md" or "sm"
textOnlyboolSets the tab buttons to display only text provided

TabBar

NameTypeDefaultDescription
borderbooltrueToggles the border below the tab buttons
classNamestringnullString of classnames to add to the TabBar container
idstringuuid()String used as the id attribute of the TabBar container

TabItem

NameTypeDefaultDescription
activestringSets the pane's active state
addOnAppendstringIcon name to display before the label
addOnPrependstringIcon name to display after the label
classNamestringString of classnames to add to the TabPane container
iconOnlystringSets the tab buttons to display only icon provided
labelstringText value to display
onClickstringCallback function for when the tab is acted upon.
textOnlystringSets the tab buttons to display only text provided

TabPane

NameTypeDefaultDescription
activeboolfalseSets the pane's active state
classNamestringnullString of classnames to add to the TabPane container
idstringnullString used as the id attribute of the TabPane container
isAnimatedbooltrueDenotes if the panel ought to fade

Data Shape

NameTypeRequired?Description
classNamestringClassname for the TabPane
contentstringYesTabPane content
disabledboolSelecting TabItem is disabled
idstringId for the Tab
labelstring or {icon,text}Text label for the TabItem or an object containing the icon and/or text label for the TabItem
tabClassNamestringClassname for the TabItem
tabIdstringId value for the TabItem