Tabs divide content into separate views which users navigate between.
- Use tabs in the main content area or, alternatively use the vertical nav component to break up separate views.
- Don't use tabs to break user interactions into a series of steps. Serial workflows are best presented in a multi-step workflow, like wizard, stepper, or a timeline.
Content projected within tabs is flexible. Follow these guidelines to organize and present content effectively:
- Place content in each view that is independent of the content in other views
- Don’t force users to navigate back and forth to compare data
- Avoid cross-linking between tabs
- When the content within a view is broad, divide it into subsections
- Avoid using tabs in a card and modal
Tabs appear in a single, non-scrollable row, above their content. The width of each tab is dependent on its label.
When there are seven or fewer tabs, limit the labels to on or two words. This ensures that all tabs appear in the container. If the application is using Angular and there need to be more than seven tabs look into the overflow input for ClrTabLink.
Use labels to organize the tabs and their content.
- Ensure that the labels show a clear relationship between views
- Favor nouns over verbs, for example, Settings, Permissions, and Performance
- Avoid generic labels such as General or Advanced
- Use title-style caps
- Avoid using icons in labels
There are four types of tabs that might be used. For optimization, tabs component uses the *clrIfActive structural directive to lazy load the content of an active tab. If you need two-way binding on the active state of a tab, use the de-sugared syntax for the ClrIfActive structural directive shown below in the two way binding example.
When there are to many horizontal tabs to fit into the viewport, use overflow to hide less important tabs.
The Clarity Angular components implement the following behaviors to make them accessible.
- The active tab has the attribute aria-selected set to true, and the others to false
- The active panel associated with the active tab has the attribute aria-hidden set to true, and the others panels to false
- ach tab should has an aria-controls attribute set to the id of the matching panel and each panel has an aria-labelledby attribute set to the id of the tab associated with the panel