Tabs
What it is
Several views of one topic, switched by a click, one visible at a time.
For example one plan seen as "deployment / cost / risk", or one command written for macOS and for Linux.
It is not for several unrelated things — that is what headings are for.
How to write it
Four rules
- The outer fence needs more colons:
::::tabsaround:::tab. Equal colons reportsDIR-202— the first:::closes the outer one - A
tablabel is required: it is the clickable button. Missing it reportsDIR-204 tabsneeds at least onetab; empty reportsDIR-204tabmay only sit directly insidetabs; elsewhere reportsDIR-202
Only one {default}
Two or more reports DIR-205; with none, the first tab is selected.
Guessing silently produces output that differs from your intent — you believe "Cost view" opens first, the reader sees "Deployment view", and nothing tells you.
What comes out
A row of buttons and a panel. Button styling is up to the theme: editorial uses a masthead style, console a segmented control, manual folder tabs.
With JavaScript off all panels are expanded, each tab's label degrading to an ordinary sub-heading. Not a word is lost. That is the starting point, not a patch.
Traps
- Keep the panels comparable in length. Three lines against three screens reads as "the short one is unfinished"
- Don't hide anything important: with JavaScript off everything is expanded, and the content is always in the DOM
- Tab labels are real headings for accessibility and deep linking, so they enter the outline — which is why the ToC skips them by default (
toc.skipTabs)