Use tabs to provide a way to switch between various related content that are grouped by logical connection in a single space. Tabs on narrow screens become a horizontally-scrollable area.
- Use tabs for sets of information that are related
- Use short and concise text to label a tab
- Use the Tab and Tab Panel component inside the Pharos Tabs component
- Set the slot attribute on Tab Panel components to "panel"
- Don't use tabs for sets of information that need to be accessed simultaneously
- Don't have only a single tab
- The content shown in the panels should have a logical connection to each other.
- The text used for a tab should aim to be a single categorical word that explains the section of the overall content being viewed when selected.
- The content shown in the panels should have a logical connection to each other.
1.3.1 Info and Relationships A 2.1.1 Keyboard
Tabs allow users to navigate through multiple sections of content easily
Via
Element that is the container for the tab set has
role="tablist"The container element should also have an aria-label that describes the title or purpose of the grouping
Each individual element has
role="tab"- Should be located within the container
The content section that populates when the tab is selected has
role="tabpanel"Each element with
role="tabpanel"has the propertyaria-labelledbyreferring to its associated tab elementIf tab list has visible label
The element with
role="tablist"hasaria-labelledbybe the same as the value that refers to the labelling element
If tab list has no visible label
- Tablist element has label provided by an aria-label
Each element with
role="tab"has the propertyaria-controlsreferring to its associated "tabpanel" elementThe tab in focus has
aria-selected="true"and the others are labeled "false"
On first element it will read: "Name of tab, selected, tab, 1 of <total tabs>, <Title of grouping>, tab group" where the title of the grouping is provided by the
aria-labelattribute on the tab container elementOn second element (and any tabs after) it will read: "Name of tab, selected, 2 of <total tabs>"
- Tab: Moves from tab to correlating panel
- Shift+Tab: Moves from panel to correlating tab
- → ↓: Cycles forwards through tabs horizontally and vertically, respectively.
- ← ↑: Cycles backwards through tabs horizontally and vertically, respectively.
- Space Enter: activates the tab (if not automatically activated)