Tab navigation
The classic radio-input tab pattern, refined: classless labels. The stylesheet finds the labels through the structure, so your markup stays clean.
Description
Each tab is a hidden radio input followed by its <label for> and a .tab-panel. Checking a radio (by click or keyboard) reveals the panel that follows it, using flex order to lay out labels, a .separator line and panels. The labels need no class name: styles target them structurally as > label.
Zero JavaScript, real focusable and clickable labels, and the checked state lives in the form itself, so tabs can be toggled from other CSS or even a dashboard KPI. Panels animate opacity and visibility smoothly.
The active underline uses $color-primary, inactive text derives from $color-text in oklch, and transitions use $transition-fast/$transition-slow.
Tabs
The checked attribute marks the initially active tab, and the radios share one name. Selecting a tab is native and keyboard-friendly: arrows and clicks work without any script, and the state lives in the form itself.
Your public profile.
Password and sessions.
<div class="tabs">
<input type="radio" name="settings-tabs" id="tab-1" checked>
<label for="tab-1">Profile</label>
<div class="tab-panel"><p>Your public profile.</p></div>
<input type="radio" name="settings-tabs" id="tab-2">
<label for="tab-2">Security</label>
<div class="tab-panel"><p>Password and sessions.</p></div>
<div class="separator"></div>
</div>Full-width tabs
Add .full-width and each label receives flex: 1: the tabs share the container's width equally instead of hugging the left edge. Ideal for top-level sections such as overview, pricing or support.
All products at a glance.
Plans and prices.
Help and contact options.
<div class="tabs full-width">
<input type="radio" name="fw-tabs" id="fw-1" checked>
<label for="fw-1">Overview</label>
<div class="tab-panel"><p>All products at a glance.</p></div>
<input type="radio" name="fw-tabs" id="fw-2">
<label for="fw-2">Pricing</label>
<div class="tab-panel"><p>Plans and prices.</p></div>
<input type="radio" name="fw-tabs" id="fw-3">
<label for="fw-3">Support</label>
<div class="tab-panel"><p>Help and contact options.</p></div>
<div class="separator"></div>
</div>