Anatomy

Links: A set of links used to switch between views. Each tab should concisely label the view it's associated with.
View: The view associated with the active tab.
Options

With related content after the tabs
Content or an action may be shown after the tabs as long as it's something that's relevant to the content in all of the tab panels. For example, a diff is shown after the tabs on a pull request.
However, the related content's element(s) should be a sibling of the element that wraps the tabs, not a child.
Tabs with counts
A counter label may be used to show a count after the text label if the tab contains enumerable content that would be helpful for users to know without activating the tab.
Tabs with icons
An icon may be shown before the tab's text label to help users understand the purpose of the tab. For example, the number of files changed on a pull request's "Files changed" tab.
Accessibility
Each tab must have a unique text label for assistive technologies like screen readers. Avoid using tabs that only use an icon as their label. If an icon makes the tab easier to understand, consider pairing the icon with a text label.
Tabs may not overflow their container - they must be clickable without requiring the user to horizontally scroll. This is a violation of the WCAG reflow criteria.
Labeling counts
If your tab shows a count of items, screen readers will read the number immediately after the tab's label. Consider whether it would sound awkward to the user, and add visually hidden text to help make it easier to understand what the number is for.
For example, "Conversation 10" is confusing because there's no context for what the "10" is referring to. Instead, we can write our markup so screen readers will say "Conversation 10 comments".
Example with screen reader text:
<span> Commits <div class="Counter">4<span class="sr-only"> comments</span></div></span>
Keyboard navigation
Each link in the tab nav should be a single Tab stop. The arrow keys should not move focus between tabs or activate tabs.
Known accessibility issues (GitHub staff only)
For internal accessibility information, please refer to the accessibility documentation.
Related links
Feedback
Help us improve this component by providing feedback, asking questions on Slack, or updating this file on GitHub.