Skip to main content

Tabs

Tabs is a linear set of two or more items, each of which presents a mutually exclusive link.

Use Tabs to alternate among related views within the same context and at the same level of hierarchy ⏤ e.g. within a Tile or Panel. Tabs and Segmented Buttons are very similar, decide depending on the context.

Example

Live Editor
Result
Loading...

Scrollable Tabs

In case there is no enough space to display the whole list of tab items Tabs component gets scrollable.

Live Editor
Result
Loading...

Usage Rules

Do:

  • Make sure that the labels show a clear relationship between views
  • Place content in each view that is independent of the content in other views

Don't:

  • Combine items with and without icon in one Tabs component
  • Nest tabs within another tab component
  • Use tabs to break user interactions into a series of steps. Serial workflows are better presented in form of a sequence map, or timeline.
  • Force users to navigate back and forth between tabs to compare data, and avoid cross linking between tabs

Use short and clear labels

To describe the content of a tab, use a label that is short and direct (and use the icon variant if labels can be supported by an icon metaphor). Favor nouns over verbs ⏤ for example: Settings, Permissions, Trackers. Try to avoid generic labels, such as General or Advanced.

When to use: Tabs vs. Segmented Buttons

Use tabs as a primary navigation element, when content can be usefully separated into clearly labelled sections, which share the same level of hierarchy. Use segmented buttons as a local control inside a particular view to switch between subsets of data within that view.

Variants

Disabled

Live Editor
Result
Loading...

Icons

Labels and icons

Live Editor
Result
Loading...

Size

The Tabs component has two sizes: small and medium.

Live Editor
Result
Loading...

Tooltip

You can add a Tooltip to Tab items by passing tooltip prop which accepts all Tooltip Component's props

Live Editor
Result
Loading...

Accessibility

The Atlas Tabs component supports keyboard navigation out of the box. The user can navigate between tabs using the arrow keys, and activate a tab using the Enter or Space keys.

To improve accessibility and stay compliant with WCAG 2.1 and our Accessibility Guidelines, it's required to pass the element ID of the tab panel which is controlled by the individual Tab Item via the ariaControls prop. Additionally, the tab panels itself should have a role="tabpanel" and an aria-labelledby attribute which points to the ID of the Tab Item.

Props

Tabs

NameTypeDefault
items *
Array of tab items. See the structure of TabItemType
TabItemType[]
onChange
The handler that is called on a new selection
((itemId: string) => void)
size
The size of the Tabs component
"small" | "medium"
"medium"
value
Id of selected item
string
css
Add custom styles to this component. Use with caution. Learn more here: Link
SupportedStyleAttributes
inputFieldCss
SupportedStyleAttributes
data-{foo}
Data attributes can be used by testing libraries to retrieve components or assert their existence
string
* - the prop is required.

Object structure of the items prop

NameTypeDefault
label *
Label of the tab item
string
id *
Tab item identifier
string
ariaControls
Provide element id whose content or presence is controlled by the current element. Check Accessibility page for more info: Link
string
disabled
The disabled state of the tab item
boolean
false
iconName
Name of the Icon that is shown next to the label. Refer to the full list here: Link
"AddValue" | "AppGrid" | "ArrowCircleLeft" | "ArrowCircleRight" | "ArrowDown" | "ArrowDownLeft" | "A...
url
The URL will be associated with the tab item and attached to an <a> element
string
tooltip
The Tooltip that shows up on label hover. Please check
Omit<TooltipProps, "children">
data-{foo}
Data attributes can be used by testing libraries to retrieve components or assert their existence
string
* - the prop is required.