Skip to content

Tab Bar

<tpg-tab-bar></tpg-tab-bar>

The Tab Bar is used for switching between a guided workflow or different information “modules”.

A minimum of 2 items is required to assemble a Tab Bar, while a maximum of 3 items per single line is recommended (but up to 5 are allowed, and 5+ for desktop).

Truncation must be enabled when the number of Tab Items exceeds the available with of the Tab Bar / parent container. The Quaternary Menu Button will appear and group the overflown Tab Items. The tab items are shown in a Menu upon clicking on the Quaternary Menu Button. If one of the overflown Tab Items from the menu are selected, the active selection will be shown with a “+” badge visible on the Quaternary Menu Button.

Component behavior

The tab item (child of tab-bar) will respond to clicks or presses inside the entirety of its area. The tab bars appearence can be customized by passing the noBackground property, and/or changing the alignment of the tab-items with the justifyContent property.

Examples

Basic usage

Basic usage with 2-6 tab items

Justify content

Set the alignment of tab-items

Tab Items with leading icon and trailing icon

Tab Items with badge

Each tab item has a slot for a badge. The badge can be customized with the label and size properties.

Tab Items with disabled state

Tables

Properties

Attribute Property Description Type Default Value
justify-content justifyContent Controls how the tab items are justified. Can be 'left', 'center', or 'stretch'. 'left' | 'center' | 'stretch' 'left'
selected-value selectedValue The currently selected tab's value. Reflected to the DOM attribute for styling. string ''

Events

Event name Reactjs attribute Description
tpg-change ontpg-change Emitted when a tab item is selected.

Functions

Name Description Arguments
No functions found.

Slots

Name Description
Reserved for tab-items.

CSS Parts

Attribute Description
No CSS parts found.

Sandbox