Components
Tabs
Switch between views of the same thing.
Segmented (default)
A muted track with the active segment lifted onto the page colour.
<div class="tabs" role="tablist">
<button class="tab" role="tab" aria-selected="true">Overview</button>
<button class="tab" role="tab" aria-selected="false">Steps</button>
</div>
| Part | Value |
|---|---|
.tabs track |
32px tall, 3px padding, 10px radius, muted fill |
.tab |
14px medium, 8px radius, 6px side padding, text at 60% foreground |
| Hover | Foreground text |
Selected (aria-selected="true") |
Page-colour fill, a 1px soft shadow, foreground text. In dark, a faint white tint with an input hairline |
Line
An underline under the active tab, for page-level sections.
<div class="tabs tabs-line has-indicator" role="tablist">
<button class="tab" role="tab" aria-selected="true">Findings</button>
<button class="tab" role="tab">Timeline</button>
<span class="tabs-indicator" aria-hidden="true"></span>
</div>
One indicator slides between tabs. Two bars crossfading read as two objects. One bar moving reads as the selection moving. Set two variables on the list from the selected tab whenever it changes:
list.style.setProperty("--active-tab-left", tab.offsetLeft + "px");
list.style.setProperty("--active-tab-width", tab.offsetWidth + "px");
The bar is 2px tall in foreground and moves over 200ms on
ease-out-strong. Many headless libraries (Base UI, Radix) expose these
measurements already. Without the indicator element, leave off
.has-indicator and each selected tab draws its own static underline.
Panels
.tab-panel fades in over 200ms. Add data-direction="left|right" to slide
it 8px in from the direction of travel. Panels have no exit animation:
an exit would hold two panels on screen.