<!-- generated by scripts/gen-docs.mjs from docs/system/nav.md. Edit the source and rerun. -->
# Nav

## Description
Takes you between the app's sections, marking the one you are on, as a row of links at the top and as a bar of tabs along the bottom of a phone.

`import { Nav, NavTabs, type NavItem, type NavProps, type NavTabsProps } from "@/components/cobalt/ui/nav"`, source `registry/cobalt/ui/nav.tsx`, status `ready-with-gaps`.
Foundation: `hand-rolled`. Traps checked: `trap/current-unmarked` (ARIA: `aria-current="page"` on the current link in both navigations, test), `trap/tabs-routes` (Usage, `rule/nav-items-are-routes`: both are `<nav>` of links, never a tablist), `trap/narrow-hidden-nav` (States, icons only: below 768px the labels hide but every link stays, named by `aria-label` and the system tooltip; States, scrolling: links wider than the bar scroll sideways with the current one in view and a fade at each edge with more past it; and Limits, `rule/nav-max-five-items`), `trap/link-cue` (States, default: a nav link's cue is its place in the `<nav>` row and the pill, not an underline, which `rule/writing-link-object` keeps for links in running text), `trap/weight-shift` (States, current: the weight stays 500 in the nav and in the tabs), `trap/safe-area` (Tokens and `NavTabs`: `pb-[env(safe-area-inset-bottom)]` on the fixed bar, test), `trap/link-as-button` (Usage, `rule/nav-items-are-routes`: every item is an `<a href>`), `trap/external-glyph-internal` (n/a, no item carries an external glyph and every item stays in the app), `trap/motion-origin` (Motion: the pill travels from the old link to the new one, never from nothing, measured), `trap/motion-frequent` (Motion: a section change is tens of times a day, one verb, Travel on the settle spring, `--t-settle`, as the segmented control and tabs move, D14), `trap/motion-layout-property` (Motion: `width` beside `transform`, the named exception, because the pill must take the new link's width and the links differ in width), `trap/reduced-motion-ignored` (Motion: `base.css` drops the transform and width transitions and the label colour change stays), `trap/hover-unguarded` (States, hover: Tailwind's `hover:` sits under `(hover: hover)`, measured), `trap/menu-navigation`, `trap/menu-only-path`, `trap/menu-diagonal`, `trap/list-dead-gap`, `trap/open-trigger-unfocused`, `trap/overlay-focus-return`, `trap/escape-nested`, `trap/exit-eats-input` (n/a, Menus traps; the nav opens nothing, and its links sit 4px apart on purpose so the pill's edge is visible, with each link `--nav-item` tall and given a 44px hit area under a touch pointer as its own target).

### Foundation
| Given by the foundation | Added by the team |
|---|---|
| Not applicable: hand-rolled | `Nav`: a `<nav aria-label>` with a `<ul>` of links `--nav-item` tall (36px, the value of `--control`, unless you set the token on your root), each on the control corner, `--r-control` (10px), `text-sm font-medium whitespace-nowrap` with 12px of side padding at every width and a 16px glyph 6px from its label that never shrinks (`shrink-0`), as on a Button, and `touch-target`, which grows the hit area to at least 44px by 44px under a touch pointer, the label hidden below 768px when the item has an icon, `aria-current="page"` on the current one, and one `aria-hidden` span measured from it through `registry/cobalt/lib/use-indicator.ts` and slid on `transition-[transform,width] duration-settle ease-settle` (D15, D17); the `<nav>` scrolls sideways when the links are wider than the room it is given, its scrollbar hidden, with `useScrollRow` and `scrollRowFade` from ChipRow (`registry/cobalt/ui/nav.tsx:60`) bringing the current link into view before paint and fading each edge with more links past it, and 4px of padding inside a 4px negative margin so the pill's shadow and a focus ring are not clipped; the pill is the `--thumb` fill with the label in ink, the selection a segmented control and tabs slide (white in the light theme, lighter than the track in the dark one); `variant="glass"` adds `glass-pill`, the `--elev-glass` edge; every link `select-none`, so a double-click on the row selects nothing; below 768px each link with a glyph is the trigger of a Tooltip that names its page; `NavTabs`: a `<nav>` fixed to the bottom edge on `glass-bar`, one 56px tab per item with the label under the glyph, no hairline or shadow along the top edge, the label `text-xs font-medium` and truncated at the tab's width, cut at its own end through `dir="auto"` and whole in the system tooltip while it is cut (`TruncatedText`), the glyph 22px, the current one in ink (`--foreground`), the colour Nav's pill label wears, so the two navigations mark the current page alike, the focus outline drawn 2px inside the tab (`--focus-offset: -2px`) because the bar meets the screen edge, padded by `env(safe-area-inset-bottom)` (D30); both take `items`, `activeKey`, `label` and `renderLink` from `registry/cobalt/lib/link.tsx` (D5, D19) |

## Examples
The pill slides to the current link, the phone's tabs take Nav's place, and a product's top bar.

Real uses, 1 call site (`rg -n "<Nav\b" app registry --glob '!registry/cobalt/ui/*'`):
- The showcase bar switches between Overview, Foundations and Components, `glass` by default, with the router's `Link` through `renderLink`, hidden below 640px, `app/shell.tsx:75-81`.

`NavTabs`, counted apart because its tag differs, 1 call site (`rg -n "<NavTabs\b" app registry --glob '!registry/cobalt/ui/*'`):
- The same three sections as the showcase's bottom bar below 640px, `app/shell.tsx:127-133`.

### Example files
| File | Covers | Caption |
|---|---|---|
| `docs/system/examples/nav/default.tsx` | default | The pill slides to the current link, and below 768px each link keeps only its glyph |
| Not applicable: default.tsx is glass, the default | variant=glass | The thumb fill with a faint shadow, for page or card |
| `docs/system/examples/nav/variant-plain.tsx` | variant=plain | The thumb fill alone, for a nav on a grey track |
| Not applicable: the current link is in every example but state-no-current.tsx | state:current | `aria-current="page"`, the label in `--foreground`, the pill under it |
| `docs/system/examples/nav/state-no-current.tsx` | state:no-current | No item is highlighted on a page outside the nav |
| Not applicable: hover is reached with the pointer on any example | state:hover | The label in `--foreground` on the press duration |
| Not applicable: focus-visible is reached with the keyboard on any example | state:focus-visible | The 2px ring around the round link |
| Not applicable: icons only is default.tsx narrowed below 768px | state:icons-only | Each link a glyph alone, naming its page through the tooltip and `aria-label` |
| `docs/system/examples/nav/state-tabs.tsx` | state:tabs | Below 640px the host renders NavTabs in Nav's place, a bar at the bottom edge with the label under each glyph |
| `docs/system/examples/nav/in-shell.tsx` | composition:Shell | A research app's top bar, its name at the start, Nav in the middle and the signed-in person's profile link at the end |

Example: The pill slides to the current link, and below 768px each link keeps only its glyph (`docs/system/examples/nav/default.tsx`)

```tsx
import { useState, type MouseEvent } from "react";

import { BookmarkIcon, HomeIcon, SearchIcon, SettingsIcon } from "@/components/cobalt/icon";
import { Nav, type NavItem } from "@/components/cobalt/ui/nav";
import type { LinkProps } from "@/lib/cobalt/link";

const items: NavItem[] = [
  { key: "home", label: "Home", href: "#home", icon: HomeIcon },
  { key: "search", label: "Search", href: "#search", icon: SearchIcon },
  { key: "watchlist", label: "Watchlist", href: "#watchlist", icon: BookmarkIcon },
  { key: "settings", label: "Settings", href: "#settings", icon: SettingsIcon },
];

export default function Example() {
  const [active, setActive] = useState("home");
  // A router would own the links; here a click only changes which item is current.
  const renderLink = ({ href, children, ...props }: LinkProps) => (
    <a
      href={href}
      {...props}
      onClick={(event: MouseEvent) => {
        event.preventDefault();
        setActive(items.find((i) => i.href === href)?.key ?? "");
      }}
    >
      {children}
    </a>
  );
  return <Nav items={items} activeKey={active} label="Main" renderLink={renderLink} />;
}
```

Example: A research app's top bar, its name at the start, Nav in the middle and the signed-in person's profile link at the end (`docs/system/examples/nav/in-shell.tsx`)

```tsx
import { useState, type MouseEvent } from "react";

import { BookmarkIcon, HomeIcon, SearchIcon } from "@/components/cobalt/icon";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/cobalt/ui/avatar";
import { Nav, type NavItem } from "@/components/cobalt/ui/nav";
import type { LinkProps } from "@/lib/cobalt/link";

const sections: NavItem[] = [
  { key: "home", label: "Home", href: "#home", icon: HomeIcon },
  { key: "search", label: "Search", href: "#search", icon: SearchIcon },
  { key: "watchlist", label: "Watchlist", href: "#watchlist", icon: BookmarkIcon },
];

export default function Example() {
  const [active, setActive] = useState("search");
  // A router would own the links; here a click only changes which item is current.
  const renderLink = ({ href, children, ...props }: LinkProps) => (
    <a
      href={href}
      {...props}
      onClick={(event: MouseEvent) => {
        event.preventDefault();
        setActive(sections.find((i) => i.href === href)?.key ?? "");
      }}
    >
      {children}
    </a>
  );
  return (
    <header className="flex h-14 w-full items-center gap-3 rounded-2xl bg-background/90 px-4">
      <div className="flex flex-1">
        <a
          href="#home"
          className="text-base font-semibold"
          onClick={(event) => {
            event.preventDefault();
            setActive("home");
          }}
        >
          Filings
        </a>
      </div>
      <Nav label="Main" activeKey={active} items={sections} renderLink={renderLink} />
      <div className="flex flex-1 justify-end">
        {/* One link around the avatar, which names it: "Maya Jacobsen". */}
        <a href="#profile" className="flex rounded-full">
          <Avatar name="Maya Jacobsen">
            <AvatarImage src="/photos/portrait-2.webp" />
            <AvatarFallback />
          </Avatar>
        </a>
      </div>
    </header>
  );
}
```

## Variants

### variant
- `glass`: the default, the `--thumb` pill with the `--elev-glass` edge, so the current link shows on the page tint (where the plain pill measures 1.07:1) and on a card. Used at 1 call site, the showcase bar.
- `plain`: the `--thumb` pill with no edge, for a nav inside a grey track that already sets the pill apart. Used at 0 call sites.

Example: The thumb fill alone, for a nav on a grey track (`docs/system/examples/nav/variant-plain.tsx`)

```tsx
import { useState, type MouseEvent } from "react";

import { HomeIcon, SearchIcon, SettingsIcon } from "@/components/cobalt/icon";
import type { LinkProps } from "@/lib/cobalt/link";
import { Nav, type NavItem } from "@/components/cobalt/ui/nav";

const items: NavItem[] = [
  { key: "home", label: "Home", href: "#home", icon: HomeIcon },
  { key: "browse", label: "Browse", href: "#browse", icon: SearchIcon },
  { key: "settings", label: "Settings", href: "#settings", icon: SettingsIcon },
];

export default function Example() {
  const [active, setActive] = useState("browse");
  // A router would own the links; here a click only changes which item is current.
  const renderLink = ({ href, children, ...props }: LinkProps) => (
    <a
      href={href}
      {...props}
      onClick={(event: MouseEvent) => {
        event.preventDefault();
        setActive(items.find((i) => i.href === href)?.key ?? "");
      }}
    >
      {children}
    </a>
  );
  return (
    <div className="w-fit rounded-full bg-muted p-1">
      <Nav items={items} activeKey={active} label="Main" variant="plain" renderLink={renderLink} />
    </div>
  );
}
```

## States
| State | Trigger | What the user can do | Shown by, besides color | Checked by |
|---|---|---|---|---|
| default | render | follow a link, focus | the row of links inside `<nav>`, `--nav-item` tall (36px) | test |
| current | `activeKey` equals an item's `key` | follow the other links | `aria-current="page"` on the link and the pill under it; the weight stays 500 | test |
| no-current | `activeKey` is `null` or matches no item | follow any link | no `aria-current` anywhere and the pill at `opacity: 0` | test |
| hover | pointer over a link, under `(hover: hover)` | follow it | pointer only, the label colour on `--t-settle`; no shape or weight change | by hand |
| focus-visible | keyboard focus on a link | follow it with Enter | the 2px ring around the round link | by hand |
| icons-only | the viewport under 768px and the item has an `icon` | follow the glyph; read its name in the tooltip | the label gone, the 16px glyph alone in a link `--nav-item` tall and 40px wide, named by `aria-label` and by the tooltip on hover and keyboard focus | screenshot |
| scrolling | the links are wider than the bar gives them, such as five translated labels at 768px | scroll the row, or Tab to a link past the edge, which scrolls fully into view | the current link in view on load, a 32px fade at each edge with more links past it, the scrollbar hidden | screenshot |
| tabs | the host renders `NavTabs` below 640px | tap a tab | the fixed bar, the label under the glyph, the current tab in ink (`--foreground`) with `aria-current="page"` | test |

Example: No item is highlighted on a page outside the nav (`docs/system/examples/nav/state-no-current.tsx`)

```tsx
import { Nav, type NavItem } from "@/components/cobalt/ui/nav";

const items: NavItem[] = [
  { key: "home", label: "Home", href: "#home" },
  { key: "browse", label: "Browse", href: "#browse" },
  { key: "settings", label: "Settings", href: "#settings" },
];

export default function Example() {
  return <Nav items={items} activeKey={null} label="Main" />;
}
```

Example: Below 640px the host renders NavTabs in Nav's place, a bar at the bottom edge with the label under each glyph (`docs/system/examples/nav/state-tabs.tsx`)

```tsx
import { useState, type MouseEvent } from "react";

import { BookmarkIcon, HomeIcon, SearchIcon, SettingsIcon } from "@/components/cobalt/icon";
import { NavTabs, type NavItem } from "@/components/cobalt/ui/nav";
import type { LinkProps } from "@/lib/cobalt/link";

const items: NavItem[] = [
  { key: "home", label: "Home", href: "#home", icon: HomeIcon },
  { key: "search", label: "Search", href: "#search", icon: SearchIcon },
  { key: "watchlist", label: "Watchlist", href: "#watchlist", icon: BookmarkIcon },
  { key: "settings", label: "Settings", href: "#settings", icon: SettingsIcon },
];

export default function Example() {
  const [active, setActive] = useState("watchlist");
  const renderLink = ({ href, children, ...props }: LinkProps) => (
    <a
      href={href}
      {...props}
      onClick={(event: MouseEvent) => {
        event.preventDefault();
        setActive(items.find((i) => i.href === href)?.key ?? "");
      }}
    >
      {children}
    </a>
  );
  // In a product the bar is fixed to the bottom of the screen; here it sits in the frame.
  return (
    <NavTabs items={items} activeKey={active} label="Main" className="static w-full max-w-sm" renderLink={renderLink} />
  );
}
```

### State precedence
- Current and hover: both show. The current label is already `--foreground`, so hovering changes nothing visible, and the pill stays.
- Current and focus-visible: both show. The ring draws outside the pill.
- Hover and focus-visible: both show. The colour and the outline are different properties.
- Current and no-current: Not applicable: `activeKey` matches one item or none.
- Icons-only and current: both show. The pill is measured from the glyph-only link and the glyph takes `--foreground`.
- Tabs and current: both show. The tab's glyph and label turn to ink (`--foreground`) from `--muted-foreground`, and the tab carries `aria-current="page"`; the item box does not change size.
- Scrolling and current: both show. The row jumps to the current link before paint, so the pill is in view; the pill scrolls with the links.
- Tabs and hover: tabs wins. The tab bar has no hover rule, since it is a touch surface, and `active:` gives the press colour instead.

### Motion
| Trigger | Kind | Preset | Properties | Reduced motion |
|---|---|---|---|---|
| the current link changes | announce | `duration-settle` (`--t-settle`, 300ms) on `ease-settle`, the settle spring the segmented control's and tabs' thumbs share, since the nav is seen many times a day (D14), `.design-system/evidence/nav/pill-slide-1280.json`; the first paint, a resize and a font swap set `transition: none`, so the pill never travels from nothing | transform (translateX) and width on the pill, width being the named exception to the transform rule because the links differ in width | the pill jumps; `base.css` drops the transform and width transitions and keeps the label colour change |
| pointer over and out, and the current label changing | announce | `duration-settle` (`--t-settle`, 300ms) on `ease-settle`, the pill's own spring, `transition-colors`, so the new label reaches its ink as the pill arrives under it and the old one fades as the pill leaves; sampled every frame, the label had 46 percent of its change while the pill had travelled 10 percent, and 90 percent at 45, and now the two stay within 1 percent in every frame (`.design-system/evidence/nav/label-ink-before.json`, `label-ink-after.json`) | color on the link | the same colour change |

## Props

<!-- Props generated from registry/cobalt/ui/nav.tsx with TypeScript by scripts/props-table.mjs -->
### Nav

| Prop | Type | Default | Purpose |
|---|---|---|---|
| `items` | `NavItem[]` |  |  |
| `label` | `string` |  | The accessible name of the navigation, such as "Main". |
| `activeKey?` | `string` |  | The key of the item for the current page. |
| `className?` | `string` |  |  |
| `renderLink?` | `RenderLink` | `defaultLink` | Swaps the plain anchor for a router link. |
| `variant?` | `"plain" \| "glass"` | `"glass"` | "glass", the default, gives the pill the lightest shadow so it shows on the page and on a card. |

### NavTabs

| Prop | Type | Default | Purpose |
|---|---|---|---|
| `items` | `NavItem[]` |  |  |
| `label` | `string` |  | The accessible name of the navigation, such as "Main". |
| `activeKey?` | `string` |  | The key of the item for the current page. |
| `className?` | `string` |  |  |
| `renderLink?` | `RenderLink` | `defaultLink` | Swaps the plain anchor for a router link. |

`Nav` takes `items` (`NavItem[]`, each with `key`, `label`, `href` and an optional `icon`), `activeKey` (`string | null`, nothing lit when it matches no item), `label` (the navigation's accessible name), `variant` (`glass`, the default, or `plain`), `renderLink` (`RenderLink` from `registry/cobalt/lib/link.tsx`, a plain anchor by default) and `className` for placement. The height of each link, and of the pill, is the `--nav-item` token: 36px by default, as `--control`; set it on your root, such as `--nav-item: 32px`, for a slimmer or taller bar. `NavTabs` takes the same without `variant`. `NavLinkProps` is an alias of `LinkProps` kept for one release. Neither forwards native attributes; the `<nav>` takes only `aria-label` and `className`. A tab's label longer than its share of the bar is cut with an ellipsis and stays whole in the tooltip and in the link's text, which a screen reader reads.

## Usage

### When to use
- The app has 2 to 5 sections and you move between them on every visit.
- The current section must be visible at a glance from any page.

### When not to use
- The links switch views of one thing in place without changing the URL. Use Tabs or SegmentedControl instead.
- The link goes one level up to a list. Use BackLink instead.
- The row is a filter whose choices can be any number. Use ChipRow instead.
- The path is deeper than one level and needs every ancestor shown. Use BackLink for one level up and a plain row of links for deeper paths, the Breadcrumb row of coverage-gaps, instead.

### Rules
- `rule/nav-current-from-the-route`: When the page changes, derive `activeKey` from the router's location, as the shell maps `pathname` to a section, instead of from the item last clicked, because the back button, a deep link and a redirect change the page without a click, and `aria-current` must say where you are now. Evidence: single use app/shell.tsx:56-61, the one real use derives it from `pathname`, and it generalizes because every router exposes the location; principle wcag: 2.4.8 Location, the current page is identified within the set. Check: review of every `activeKey` source.
  - Don't: `const [active, setActive] = useState("home"); <Nav items={items} activeKey={active} label="Main" renderLink={(p) => <a {...p} onClick={() => setActive(keyOf(p.href))} />} />`
  - Do: `const { pathname } = useLocation(); <Nav items={items} activeKey={sectionOf(pathname)} label="Main" renderLink={renderLink} />`
- `rule/nav-items-are-routes`: When an item is listed, give it an `href` the router owns and pass the router's `Link` through `renderLink`, instead of a `button` that calls `navigate()` or a `role="tablist"`, because a nav of pages is a list of links, which open in a new tab, show their address and are announced as "link, current page", and the plain anchor reloads the app. Evidence: person D5; person D19; single use app/shell.tsx:30, the one real use wraps the router's `Link`. Check: test `nav.test.tsx` renders every item as `<a href>` through the host's link and finds no `<button`.
  - Don't: `<Nav items={sections.map((s) => ({ ...s, href: "#" }))} activeKey={section} label="Sections" renderLink={({ children, ...p }) => <button onClick={() => navigate(p.href)}>{children}</button>} />`
  - Do: `<Nav items={sections} activeKey={section} label="Sections" renderLink={({ href, children, ...p }) => <Link to={href} {...p}>{children}</Link>} />`
- `rule/nav-pair-with-tabs-below-640`: When the nav is the app's main navigation, render `Nav` with `className="hidden sm:flex"` and `NavTabs` with `className="sm:hidden"` from the same `items` and `activeKey`, because at 390px the bar's 310px column holds the icons but not the labels, and the bottom bar puts every label back where a thumb reaches. Evidence: single use app/shell.tsx:80 and app/shell.tsx:132, the one real use trades the two at 640px, and it generalizes because the bar's width, not the app, sets the break; measured the labels hidden at 390 and shown at 768, `.design-system/evidence/nav/grow-count-390.json`. Check: review of every `Nav` for its `NavTabs` twin.
  - Don't: `<Nav items={sections} activeKey={section} label="Sections" />`
  - Do: `<Nav items={sections} activeKey={section} label="Sections" className="hidden sm:flex" /> <NavTabs items={sections} activeKey={section} label="Sections" className="sm:hidden" />`
- `rule/nav-icon-on-every-item-or-none`: When one item has an `icon`, give every item one, because below 768px only an item with an icon hides its label, so a mixed list shows 2 words and a glyph, and `NavTabs` draws an empty 22px slot above a label with no glyph. Evidence: single use app/shell.tsx:21-23, the one real list gives every section an icon; principle heuristic: consistency and standards, one shape per row. Check: review of every `items` array.
  - Don't: `const items: NavItem[] = [{ key: "home", label: "Home", href: "/", icon: HomeIcon }, { key: "browse", label: "Browse", href: "/browse" }];`
  - Do: `const items: NavItem[] = [{ key: "home", label: "Home", href: "/", icon: HomeIcon }, { key: "browse", label: "Browse", href: "/browse", icon: SearchIcon }];`
- `rule/nav-glass-by-default`: When a nav is rendered, leave `variant` unset so the pill is glass, and pass `variant="plain"` only inside a grey track that sets the pill apart, because the plain pill measures 1.07:1 on the page tint and disappears on a card, and the glass edge keeps the current page visible on both. Evidence: measured the plain pill at 1.07:1 on the page tint and the glass pill at 1.16:1 on the track, `.design-system/evidence/nav/colors-1280.json`; person D15. Check: test `nav.test.tsx` renders the default nav and expects `glass-pill`; review of every `variant="plain"`.
  - Don't: `<Nav items={items} activeKey="home" label="Main" variant="plain" />`
  - Do: `<Nav items={items} activeKey="home" label="Main" />`

### Content
- Follows `rule/writing-link-object`.
- `rule/nav-label-is-one-noun`: When an item is labelled, write one noun in sentence case naming the section, such as "Foundations", at most 11 characters, because at 768px a labelled link is 85 to 102px wide and the row runs past the viewport at its seventh link, so a two-word label spends the one link of room that five items leave. Evidence: person D11; measured links of 85 to 102px and the seventh link past the viewport at 768, `.design-system/evidence/nav/grow-count-768-consistency.json`. Check: review of every `NavItem` label.
  - Don't: `{ key: "components", label: "All the components", href: "/components" }`
  - Do: `{ key: "components", label: "Components", href: "/components" }`

### Anti-slop
- `rule/nav-no-own-indicator`: When an agent marks the current link with `border-b-2`, `font-bold` or an underline through `renderLink`, spread the given `className` untouched and pass no mark of its own, because the pill is the one selection indicator and a weight change widens the label and moves its neighbours. Evidence: person D17; measured the current and rest weights both 500 after a click, `.design-system/evidence/nav/pill-slide-1280.json`. Check: review of every `renderLink` for a class added to the link.
  - Don't: `renderLink={({ href, children, className, ...p }) => <Link to={href} className={cn(className, p["aria-current"] && "border-b-2 font-bold")} {...p}>{children}</Link>}`
  - Do: `renderLink={({ href, children, ...p }) => <Link to={href} {...p}>{children}</Link>}`
- `rule/nav-no-spring-or-fade`: When an agent animates the current state with a spring library or by fading one highlight out and another in, leave the pill to its CSS transition on `duration-settle`, because one span that moves is the agreed indicator and a spring with a shadow was the version the owner turned down. Evidence: person D15; measured two CSS transitions of 450ms after a click and none at load, before the pill moved to the 300ms settle spring it now shares with the segmented control and tabs, `.design-system/evidence/nav/pill-slide-1280.json`. Check: probe `.design-system/scripts/measure-menus-nav.mjs` reads `getAnimations()` on the pill after a click.
  - Don't: `<motion.span layoutId="nav-pill" transition={{ type: "spring", stiffness: 500, damping: 30 }} className="absolute inset-0 rounded-full bg-card shadow" />`
  - Do: `<Nav items={items} activeKey={section} label="Main" />`
- `rule/nav-no-tablist`: When an agent writes the phone bar as `Tabs` with a `navigate()` in `onValueChange`, render `NavTabs` with the same `items` instead, because the bar changes the URL and a tablist promises panels that switch in place. Evidence: principle wcag: 4.1.2 Name, role, value, a link to a page is a link; person D19. Check: test `nav.test.tsx` renders `NavTabs` as a `<nav>` of three `<a>` with one `aria-current="page"`.
  - Don't: `<Tabs value={section} onValueChange={(v) => navigate(routes[v])}><TabsList>{sections.map((s) => <TabsTrigger key={s.key} value={s.key}>{s.label}</TabsTrigger>)}</TabsList></Tabs>`
  - Do: `<NavTabs items={sections} activeKey={section} label="Sections" className="sm:hidden" />`

### Limits
- `rule/nav-max-five-items`: When the app would have more than 5 sections, fold the rest under one "More" section with its own page instead of adding a sixth item, because at 768px with labels the links are 85 to 102px wide and the seventh runs past the viewport (785 > 768px), where the row scrolls and the sections past the edge are out of sight, so five keeps one link of room for a longer label, and at 390px the icon row holds 14 links before the fifteenth leaves the viewport. Evidence: measured the viewport passed at 7 labelled items at 768 and at 15 icon items at 390, `.design-system/evidence/nav/grow-count-768-consistency.json` and `.design-system/evidence/nav/grow-count-390-consistency.json`. Check: probe `.design-system/scripts/measure-menus-nav.mjs` at 390 and 768.
  - Don't: `<Nav items={sixSections} activeKey={section} label="Sections" />`
  - Do: `<Nav items={[...fourSections, { key: "more", label: "More", href: "/more", icon: ListIcon }]} activeKey={section} label="Sections" />`

## Accessibility
Rests on `<nav aria-label>` holding plain `<a href>` links, with `aria-current="page"` on the current one.

### Keyboard
| Key | Where focus is | Effect | Focus after | Checked by |
|---|---|---|---|---|
| Tab and Shift+Tab | before, inside or after the nav | moves through the links in order; the pill is not focusable | the next or previous link | by hand |
| Enter | a link | follows it; the router moves the page and `aria-current` moves with `activeKey` | where the router puts it, the new page | by hand |
| Space | a link | nothing, since a link is not a button | the link | by hand |

### ARIA
| Part | Role | Accessible name from | States and properties | Announced | Checked by |
|---|---|---|---|---|---|
| nav | navigation | `aria-label` from `label` | none | "navigation, Main" on entering | test |
| link | link | its text, or `aria-label` from `label` when an icon is set, with the same name in the tooltip below 768px | `aria-current="page"` on the current one | "link, Foundations", and "current page" on the current one | test |
| icon | none | none, `aria-hidden="true"` | none | nothing | test |
| pill | none | none, `aria-hidden="true"` | `style` with the transform and width | nothing | test |
| tabs nav | navigation | `aria-label` from `label` | none | "navigation, Main" | test |
| tab | link | its text | `aria-current="page"` on the current one | "link, Settings, current page" | test |

## Tokens
| Part | State | Token |
|---|---|---|
| link | all | `--nav-item` (36px by default, set on your root to change), `--touch` as the hit area under a touch pointer, `--t-press`, `--curve`, `--r-lg` |
| link | rest | `--muted-foreground` |
| link | hover and current | `--foreground` |
| pill | all | `--thumb`, `--nav-item` as its height, `--r-control`, `--t-settle`, `--curve-settle` |
| pill | glass, the default | `--elev-glass` |
| tabs bar | all | `glass-bar` (`--background` at 88 percent, `--blur-glass`), `--inset-bottom` when a frame sets it (the docs' phone view does), else `env(safe-area-inset-bottom)` |
| tab | rest | `--muted-foreground` |
| tab | current | `--foreground` |

## Related
- Tabs: views of one thing switched in place, with the same pill.
- SegmentedControl: two or three fixed options in one track.
- BackLink: the way one level up.
- ChipRow: a scrolling row of filter links.
- Sheet: holds a task that is taller than a dialog, floating in from the side of the page.
- TextLink: a link inside a sentence or beside a heading.
- SettingsLayout: the sections of a settings page, in a list beside the open one.
- PageHeader: a page's title, the way back and the page's own actions.
- Sidebar: the app's navigation down the side, in groups, with a mark that slides to the current place.
