Tabs allow the user to interact across the sections to switch from one set of content to another, making the transition easily from one peer to the other.
Tabs can get different states based on user interaction. States: inactive, enabled, hover, pressed, focus and disabled.
| Component token | Element | Core token | Value |
|---|---|---|---|
selectedBackgroundColor | Tab item | color-white | #ffffff |
unselectedBackgroundColor | Tab item:enabled | color-white | #ffffff |
hoverBackgroundColor | Tab item:hover | color-purple-100 | #f2eafa |
pressedBackgroundColor | Tab item:active | color-purple-200 | #e5d5f6 |
selectedFontColor | Label | color-purple-700 | #5f249f |
unselectedFontColor | Label | color-grey-700 | #666666 |
disabledFontColor | Label:disabled | color-grey-500 | #999999 |
selectedIconColor | Icon | color-purple-700 | #5f249f |
unselectedIconColor | Icon | color-grey-700 | #666666 |
disabledIconColor | Icon:disabled | color-grey-500 | #999999 |
focusOutline | Tab item outline | color-purple-700 | #5f249f |
selectedUnderlineColor | Tab item border botton | color-purple-700 | #5f249f |
dividerColor | Separator | color-grey-400 | #bfbfbf |
badgeBackgroundColor | Badge container | color-red-700 | #d0011b |
badgeFontColor | Label | color-white | #ffffff |
Each tab must have a unique title that clearly describes tab panel content. This is particularly helpful for users of assistive technologies so they have the necessary information to efficiently navigate the content.
Content authors need to ensure the content that is added to the tab panel is accessible. For example, if you add an image to the panel you need to include alternative text to pass accessibility testing.
W3C WAI-ARIA Tab Design Pattern covers the usage of ARIA names.
| key | Description |
|---|---|
Enter or Space | Activates the tab if it was not activated automatically on focus. |
Tab | When focus moves into the tab list, places focus on the active tab element. When the tab list contains the focus, moves focus to the next element in the page tab sequence outside the tablist, which is typically either the first focusable element inside the tab panel or the tab panel itself. |
Left-arrow | Moves focus to the previous tab. If focus is on the first tab, moves focus to the last tab. Optionally, activates the newly focused tab. |
Right-arrow | Moves focus to the next tab. If focus is on the last tab element, moves focus to the first tab. Optionally, activates the newly focused tab. |