Navigation
Ways to move around a site. The breadcrumb is plain HTML and CSS; pagination and tabs get their behavior from small JavaScript modules, wired here by autoInit().
Breadcrumb 01
<nav class="ap-c-breadcrumb" aria-label="Breadcrumb">
<ol class="ap-c-breadcrumb__list">
<li class="ap-c-breadcrumb__item"><a class="ap-c-breadcrumb__link" href="/fleet">Fleet</a></li>
<li class="ap-c-breadcrumb__item"><a class="ap-c-breadcrumb__link" aria-current="page">Night Heron</a></li>
</ol>
</nav>
The last item carries aria-current="page". Separators are generated content that screen readers skip; change them with --ap-breadcrumb-separator (a CSS string). Long paths wrap.
| Token | Default |
|---|---|
--ap-breadcrumb-gap | var(--ap-space-sm) |
--ap-breadcrumb-link-color | var(--ap-text-muted) |
--ap-breadcrumb-link-hover-color | var(--ap-link) |
--ap-breadcrumb-current-color | var(--ap-text) |
--ap-breadcrumb-separator | "/" |
--ap-breadcrumb-separator-color | var(--ap-text-subtle) |
Pagination 02
Buttons: pick a page, ap:page reports it here.
Links (data-ap-href): they navigate like any link; at either end the step is disabled.
<!-- links: the server renders each page -->
<nav data-ap-pagination data-ap-page="2" data-ap-count="12" data-ap-href="?page={page}" aria-label="Log pages"></nav>
<script type="module">
import { autoInit, createPagination } from 'astrostyle/js'
autoInit(document)
// buttons: load the page yourself
const pages = createPagination(nav, { page: 1, count: 12 })
nav.addEventListener('ap:page', (event) => loadPage(event.detail.page))
</script>
The window keeps the same number of items while you page, so the control never jumps. Options: siblings, boundaries, labels. Cancel ap:page on links to route on the client.
| Token | Default |
|---|---|
--ap-pagination-gap | var(--ap-space-xxs) |
--ap-pagination-size | var(--ap-size-control) |
--ap-pagination-radius | var(--ap-radius-pill) |
--ap-pagination-fg | var(--ap-text) |
--ap-pagination-hover-bg | color-mix(in oklab, var(--ap-text) 8%, transparent) |
--ap-pagination-current-bg | var(--ap-accent) |
--ap-pagination-current-fg | var(--ap-on-accent) |
--ap-pagination-gap-color | var(--ap-text-subtle) |
Tabs 03
Vega, Okonkwo, Hasegawa and Marlowe are aboard.
Twelve plasma cells, one Medusa spike, two drone frames.
Shields and life support online; cloak offline.
Locked.
Left the Corsair dock at 07:40.
Three jumps, one ambush.
Forty-two cycles of records.
<div class="ap-c-tabs" data-ap-tabs>
<div class="ap-c-tabs__list" aria-label="Ship sections">
<button class="ap-c-tabs__tab" type="button">Crew</button>
<button class="ap-c-tabs__tab" type="button" aria-selected="true">Cargo</button>
</div>
<section class="ap-c-tabs__panel">…</section>
<section class="ap-c-tabs__panel">…</section>
</div>
Keyboard: ←/→ move between tabs in reading order (skipping disabled ones; right to left, ← is next), Home/End jump to the ends, Tab goes to the panel. The second set uses manual activation (data-ap-tabs="manual"): arrows move focus, Enter selects. Without JavaScript every panel is shown.
| Token | Default |
|---|---|
--ap-tabs-gap | var(--ap-space-xxs) |
--ap-tabs-border-color | var(--ap-border-subtle) |
--ap-tabs-tab-fg | var(--ap-text-muted) |
--ap-tabs-tab-hover-fg | var(--ap-text) |
--ap-tabs-tab-hover-bg | color-mix(in oklab, var(--ap-text) 6%, transparent) |
--ap-tabs-selected-fg | var(--ap-text) |
--ap-tabs-indicator-color | var(--ap-accent) |
--ap-tabs-indicator-size | var(--ap-border-width-strong) |
--ap-tabs-panel-padding | var(--ap-space-lg) |