Nav
A real <nav aria-label> wrapping a real<ul>, a list of links is exactly what a list is for.aria-label is required because a page can have more than one <nav> (primary nav, breadcrumbs, pagination), each needs its own accessible name so a screen reader user can tell them apart. Compose it with NavLink, which renders<li><a></a></li>.
The active link is marked with aria-current="page". That's the consumer's job, not the component's — in Astro, compute it at build time from Astro.url.pathname and pass it straight through. The active style is a plain [aria-current="page"] selector, nothing client-side has to run to know which link is active.
Usage
import { Nav, NavLink } from "@kernelui/react";
<Nav aria-label="Docs">
<NavLink href="/">Overview</NavLink>
<NavLink href="/components/" aria-current="page">
Components
</NavLink>
<NavLink href="/theming">Theming</NavLink>
</Nav>Props
| Component | Prop | Type |
|---|---|---|
Nav | aria-label | string (required) |
NavLink | href | string |
NavLink | aria-current | "page" | undefined |
Accessibility
Navrenders a native<nav>, exposed as anavigationlandmark. The requiredaria-labelgives each one on the page a distinct accessible name.NavLinkrenders a real<a>inside a real<li>, so it's keyboard-focusable and works with browser link affordances (open in new tab, copy link) for free.- Set
aria-current="page"on the link matching the current route so assistive tech and the[aria-current="page"]style both know which item is active.