A row of links between the pages of one section.
Installation
Usage
import { RouteNav } from "./ui/uicontext/components/kit/RouteNav.ts"export const SettingsNav = <M>(h: Html.H<M>, current: string) => RouteNav(h, { label: "Settings", current, items: [ { id: "general", label: "General", href: "/settings" }, { id: "members", label: "Members", href: "/settings/members" }, { id: "billing", label: "Billing", href: "/settings/billing" }, ], })Examples
Narrower than its links
The row scrolls sideways instead of wrapping, and the current page scrolls into view.
API reference
Options
| Name | Type | Description |
|---|---|---|
labelrequired | string | The landmark's accessible name: "Settings". |
itemsrequired | RouteNavItem[] | The links, each with an id, a label, an href and an optional glyph. |
current | string | The id of the link to the page shown now, marked as the current page. |
style | Style | StyleX styles for the row. |
linkStyle | Style | Applied to every anchor after its default styles. |
currentStyle | Style | Applied last to the current anchor. |
glyphStyle | Style | StyleX styles for each link's glyph. |
Accessibility
- A
navlandmark named by itslabel, holding real links; the current page isaria-current="page".