Shells
Tabs
Top-level navigation, in a masthead or standing on its own. The current tab is filled and blocked; the rest are transparent until hovered.
The current tab gets the same treatment as a pressed pill, because it
is the same idea: this one is on. It is marked with aria-current="page"
rather than a modifier class, so the appearance cannot disagree with what a
screen reader is told.
Each tab carries a control-weight border in transparent at rest, which
hover fills in from the rule ramp: the border is always there, so nothing
shifts by 3px when the cursor arrives.
Tabs are anchors or buttons, interchangeably: a strip that moves between URLs
is links, and a strip inside an application that swaps a view in place is
buttons. Inside .axi-mast, margin-left: auto pushes the set to the end of
the masthead; that margin is scoped to the masthead, so a strip spanning a
view on its own starts where its container does.
A tab the reader can close wraps its label and its .axi-tabs__close control
in one .axi-tabs__tab, so the strip's gap falls between tabs rather than
between a tab and its own X. The close control is an affordance of the tab and
not a tab itself, so it opts out of the tab treatment and stays faint until the
cursor reaches it.
--scroll is for a strip with more tabs than room. .axi-tabs is a flex row
with no wrap, so a strip too wide for its container overflows, and outside a
scroll container the tabs past the edge are simply unreachable. The language
already believed this twice and could say it in neither place a consumer could
use: once behind .axi-mast, and once at the 640px breakpoint, where every
strip scrolls. A standalone strip above that breakpoint with one tab too many
had nowhere to look, and the consumer that hit it wrote overflow-x: auto on
its own wrapper - the fourth arrival of the pattern in
"A style only reachable through a layer will be re-invented".
A modifier and not the base rule, deliberately. overflow-x: auto computes
overflow-y from visible to auto, so a strip that scrolls is also a strip
that clips vertically - a focus ring, a badge hanging off a tab, a popover
anchored to one. Every strip paying that to fix the strips that are too long is
the wrong trade.
The scrollbar is left visible, and the quiet-scroll rule deliberately does not name this. That rule is about a bar down the side of a narrow strip, where the object's own edge is already a vertical line and a count elsewhere already says how many rows there are. A tab strip scrolling sideways has no second signal: the bar is the only thing saying there are more tabs.
More tabs than room
The strip scrolls instead of losing the tabs past the edge<nav class="axi-tabs axi-tabs--scroll" style="max-width: 420px">
<button aria-current="page">Overview</button>
<button>Offense</button>
<button>Defense</button>
<button>Support</button>
<button>Healing</button>
<button>Conditions</button>
<button>Boons</button>
</nav>
A nav with one current tab
<nav class="axi-tabs">
<a href="#" aria-current="page">Gallery</a>
<a href="#">Components</a>
<a href="#">Rules</a>
<a href="#">Theming</a>
</nav>
The same strip as buttons, for a view swapped in place
<nav class="axi-tabs">
<button type="button" aria-current="page">Dashboard</button>
<button type="button">Stats</button>
<button type="button">History</button>
<button type="button">Settings</button>
</nav>
Closable tabs, for documents rather than places
<nav class="axi-tabs">
<button type="button">Reports</button>
<span class="axi-tabs__tab">
<button type="button" aria-current="page">Tuesday raid</button>
<button class="axi-tabs__close" type="button" aria-label="Close Tuesday raid"><svg class="axi-icon" aria-hidden="true"><use href="#axi-x"/></svg></button>
</span>
<span class="axi-tabs__tab">
<button type="button">SMC push</button>
<button class="axi-tabs__close" type="button" aria-label="Close SMC push"><svg class="axi-icon" aria-hidden="true"><use href="#axi-x"/></svg></button>
</span>
</nav>