Skip to content
Cojeev UI

Reading trail

Navigation

Tracks actual reading progress and links to named sections with a quiet organic marker.

React · copy into your project · light and dark themes

Try it

Loading preview…

Take it with you

Copy the example, API and usage notes for your editor or AI assistant.

Add to your project

Terminal
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/reading-trail.json

The command includes the component’s shared dependencies. Your project keeps editable source files.

Using reading trail

  • Pass items with existing document IDs and readable labels. Native anchors remain available before JavaScript.

  • Use scrollRoot for a contained scrolling panel. The default tracks the document; offset sets the current-section activation line.

  • Duplicate IDs are consolidated. Missing sections do not claim measured progress.

API

Compose the exported parts below. The prop types are read from the React source during the registry build.

Native element or underlying primitive props are inherited where declared, including accessible labels, event handlers and refs.

ReadingTrailProps

PropTypeRequired
items

IDs of sections in this document. Labels and links render on the server.

readonly ReadingTrailItem[]Yes
labelstringNo
scrollRoot

Omit to track the document; pass a mounted scroll container for a panel.

HTMLElement | nullNo
offset

Activation line below the scroll viewport's top, in pixels.

numberNo

Accessibility

  • Links preserve modifier clicks and normal URLs. A selected destination receives focus.

  • Current section is exposed through aria-current. Optional smooth scrolling respects shared quiet settings.

States and appearance

restscrollingfocusedreduced-motion

For conditional content, keep a MotionPresence boundary around keyed MotionSurface children. The shared entrance and exit states work with native primitives and respect your motion preference.

Try pointer and keyboard interaction, and switch the appearance control in the navigation to compare light and dark mode. Motion respects reduced motion preferences.