Skip to content
GitHub (opens in a new tab)

AnchorNav

A list of the sections on one long page. It jumps to a section and shows the one the page is at.

stableMoleculecontracts/anchornav.json

Preview

AnchorNav

A list of the sections on one long page. Click a row to jump, and the caret follows the section in view. The menu variant is the same list in a popover.

Master

The rail beside a scrolling page. The current row keeps the caret and the strong line. Variants shows the menu.

Details

Name, owner, and the account this record belongs to.

Billing

Terms, the billing day, and the invoice the run writes to.

Usage

Metered lines, the rate they are billed at, and this period's totals.

History

Every change on the record, newest first.

Usage

Pass items whose ids match sections on the page. spy follows scroll. offset keeps the jump clear of a sticky header. Use the menu variant on a narrow screen. DocsNav is for the product, Tabs switch views, and ProgressSteps is a flow.

Do's

  • A long page split into named sections, like settings or a long record
  • A reading page where people need to see where they are and jump

Don'ts

<AnchorNav variant="rail" items={[{ id: "details", label: "Details" }]} />

When to use

  • A long page split into named sections, like settings or a long record
  • A reading page where people need to see where they are and jump

When not to use

  • App navigation — use SideNav (product) or DocsNav (docs/catalog)
  • Switching views on one screen — use Tabs
  • Steps in a flow — use ProgressSteps

What an agent reads

import { AnchorNav } from "agentic-ds-kit";
must
  • Escape closes only this panel, not a parent Modal, Drawer or AlertDialog
  • Rail is a nav landmark. Each row is a link to the section id
  • The current section has aria-current=location, a caret, and a strong line
  • Clicking a row scrolls to the section and moves focus to it
  • Arrow keys, Home, and End move between rows
  • Menu variant: the trigger is a button with aria-expanded. Escape closes and returns focus to the trigger
  • Do not point a row at a section that is not on the page
  • Hover: the fill is one decorative layer (aria-hidden) that glides to the link on hover and keyboard focus (clip-path only, --motion-expand-*); it lands in place on first show, after the pointer leaves and on resize or scroll, and jumps with no slide under prefers-reduced-motion. Roles, aria-current and focus order are unchanged and the focus ring stays on the link. The current section keeps its bar and brand text
defaults
  • variant rail
  • spy true
  • offset 0
  • ariaLabel On this page
  • menuLabel On this page
stops if
  • Do not use AnchorNav for app navigation — use SideNav (product) or DocsNav (docs/catalog)
  • Do not use it to switch views — use Tabs
  • Do not use it for steps in a flow — use ProgressSteps
  • Do not point a row at a section that is not on the page
  • Do not use raw hex

From contracts/anchornav.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
itemsarrayYes—Each id is the id of that section on the page.
variantrail | menuNorailrail is the list. menu is the same list in a popover for narrow screens.
spybooleanNotrueFollow the section in view.
offsetnumberNo0Pixels to keep clear of a sticky header when jumping.
ariaLabelstringNoOn this page—
menuLabelstringNoOn this pageMenu trigger label before a section is current.
  • Component
    →

    SideNav

    Product side nav: brand header, icon items, optional badges, closeable; variant single (one column that closes to an icon rail) or rail-subnav (a fixed icon rail plus a SideNav.SubNav column with the picked parent's rows).

  • Component
    →

    DocsNav

    Docs and catalog sidebar only: title, grouped text-only links, optional decorative icons and muted counts on group and subgroup headers only, an active page pill and optional footer links.

  • Component
    →

    Tabs

    Switch between related views in place.

  • Component
    →

    ProgressSteps

    Ordered wizard steps as numbered circles with a connecting line and a status word under each label: Done, Current, Upcoming, Error, or Optional.