Component packs › Transit › Scroll Line

Scroll Line

The contents are a route beside the article: the line fills as you read, the train sits where you are and each station lights as you reach it.

Scroll Line is a table of contents from Transit, a component pack with 8 components: Navigation components drawn as one metro line. Price: $2 for the whole pack.

Built with: scrollspy, scroller only, motion profile scroll.

Code: React and Next.js (TypeScript), Vue 3, plain HTML/CSS/JS, Tailwind CSS v4 and Motion (motion.dev). No npm packages needed. Keyboard accessible, with a reduced-motion version, in dark and light.

Scroll Line props

PropTypeDefaultDescription
titlestringTitle over the contents.
sectionsScrollLineSection[]
scrollerHTMLElementYour own scroll container and section elements (instead of the demo article).
targetsHTMLElement[]
onChange(index: number) => void
theme'dark' | 'light'
autoplaybooleanShowcase mode: reads down the article and back until touched.

Methods on the ref

Use it in React

import ScrollLine from './ScrollLine';

<ScrollLine />

The Vue, HTML, Next.js, Tailwind and Motion versions take the same options.

More in Transit

Good for: Navigation and menus.