Use tabs for a local variation
Tabs are a good fit when one part of a page changes but the surrounding explanation still applies to everyone.Example of tabs
npm can go straight to the relevant command. The instruction that applies to everyone stays outside the tabs.
Tabs also work well for:
- Operating system variations such as macOS, Windows, and Linux
- SDK examples in Python, Node.js, and Ruby
- Authentication methods chosen earlier in a setup flow
- A short section that differs for administrators and members
Keep tab choices consistent
When tab groups on a page share a title, selecting that title updates the other groups too. If a reader selectsPython once, the rest of the page can follow that choice.
Titles must match exactly. Python, python, and Python 3 are three different selections.
Tab groups that sync
Tabs with syncing disabled
When tabs get in the way
Don’t use tabs for options readers need to compare. Switching back and forth makes differences harder to see. Use a table, columns, or short sections instead. Don’t bury a recommendation in tabs. If one option is right for most readers, recommend it before showing the alternatives. Don’t use tabs to make a page look shorter. Required instructions should stay visible, and a procedure with substantially different paths is usually easier to follow as separate guides. Long rows of tabs can also become difficult to scan, especially on smaller screens. For a large set of language examples, consider a<CodeGroup> with the dropdown prop.
Finally, don’t repeat a distinction the site navigation already makes. If administrators and members have separate sections, role-based tabs inside those pages are a sign that the content may be in the wrong place.
Next up: Code groups for multi-language examples — How code groups handle the specific case of showing the same code in multiple languages.