Outline

Links to the sections of a page, indented by depth, with a mark on the one you are reading. Compact shows ticks.

Features

  • Section links indented by heading depth, with a tick that grows and inks on the section you are reading.
  • The current section is the last heading past the top third of the window, checked once a frame while scrolling.
  • Compact draws ticks only and opens into the labelled list on hover or focus.

Use it for

  • Articles and docs.
  • Long settings pages.

On this site

Installation

  1. Get runets.
    git clone https://github.com/ziyam-khan/runets
  2. Copy these files into your project, keeping their folders.
  3. Install what they use.
    pnpm add react
  4. Load the styles once. Bring your own base tokens, or use runets’ default theme.
    import 'runets/styles/theme.css'
    import 'runets/styles/kit.css'

API

PropTypeWhat it does
items{ title, url, depth }[]url is the #id of the heading.
labelstringThe nav label (On this page).
compactbooleanTicks that open on hover or focus.

Accessibility

Source

The code is in src/kit/outline.tsx in runets, MIT licensed.