Reading trail
NavigationTracks actual reading progress and links to named sections with a quiet organic marker.
Try it
Add to your project
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/reading-trail.jsonThe 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
| Prop | Type | Required |
|---|---|---|
itemsIDs of sections in this document. Labels and links render on the server. | readonly ReadingTrailItem[] | Yes |
label | string | No |
scrollRootOmit to track the document; pass a mounted scroll container for a panel. | HTMLElement | null | No |
offsetActivation line below the scroll viewport's top, in pixels. | number | No |
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
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.