← ui-lab

Scrollspy

A table-of-contents navigation linked to a scrollable region. As the region scrolls, the link for the section at the top of the viewport is marked aria-current="true"; clicking a link scrolls its section to the top. At the bottom of the range the last section is current — the case naïve implementations miss.

Preview

Introduction

Introduction section content. Scroll to bring the next section to the top.

Installation

Installation section content. Scroll to bring the next section to the top.

Usage

Usage section content. Scroll to bring the next section to the top.

API

API section content. Scroll to bring the next section to the top.

Installation

npx shadcn@latest add https://ui.publictheta.com/r/scrollspy.json

Conformance

This component conforms to the @publictheta/ui-spec scrollspy specification. Run the suite against any implementation with pnpm conformance.