U.S. flagA digital services project by Flexion

In-Page Navigation

navigationUSWDS-derivedinteractive

A sticky sidebar table of contents auto-generated from page headings, with scroll spy highlighting.

Reference: USWDS documentation ↗

Variants

Custom Heading Levels

Section One

Content for section one.

Section Two

Content for section two.

Section Three

Content for section three.

Default In Page Nav

Overview

This is the overview section of the page. It provides a high-level introduction to the content below.

Getting started

Here you will find instructions on how to get started with this feature.

Installation

Step-by-step installation instructions go here.

Configuration

Configuration details and options are described here.

Usage

Examples of how to use this feature in your project.

API Reference

Detailed API documentation for developers.

Contract

Class mapping

USWDSFlexNotes
usa-in-page-nav<flex-in-page-nav> (custom element)Container element
usa-in-page-nav__nav.flex-in-page-nav__navSticky nav container with border-left
usa-in-page-nav__heading.flex-in-page-nav__heading"On this page" heading
usa-in-page-nav__list.flex-in-page-nav__listTOC link list
usa-current.flex-in-page-nav__link--current / [aria-current="true"]Active section highlight

Verified properties

font-familyfont-sizeline-heightcolortext-decorationfont-weight

Intentional differences

border-left: ours = 3px solid transparent / accent (on links), USWDS = applied via ::after pseudo-element on .usa-current

We use border-left directly on links for the active indicator; USWDS uses a ::after pseudo-element with border-radius

Behavior promises

  • ✓ Scans page for headings and builds TOC
  • ✓ Generates IDs for headings without them
  • ✓ Scroll spy highlights current section via IntersectionObserver
  • ✓ Clicking TOC link smooth scrolls to section
  • ✓ Configurable heading levels via data-heading-levels
  • ✓ Accessibility audit passes

Source CSS