Tracing Beam
MotionA React tracing beam that draws a glowing SVG line beside long content as the reader scrolls, with a bright tip and a node that lights up for each entry.
Installation
npx shadcn@latest add @minidev/tracing-beam
MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/tracing-beam.json
Usage
import { TracingBeam } from "@/components/ui/tracing-beam"
export function Example() {
return (
<TracingBeam />
)
}
API reference
| Prop | Type | Default |
|---|---|---|
| itemsEntries to trace. Each one gets a node on the beam. | TracingBeamItem[] | DEFAULT_ITEMS |
| childrenYour own content in place of the entries. Each direct child gets a node. | React.ReactNode | - |
| colorBeam colour. Any CSS colour, including var(--token). Defaults to the accent. | string | "var(--accent)" |
| railWidth of the rail the beam runs in, in pixels. | number | 40 |
| className | string | - |
When to use
Use it for changelogs, timelines and long step-by-step stories. Reach for the free Timeline for a static list, and StickyFeatureStory or ScrollChapterStory for full-screen scroll chapters.
Accessibility
- The rail SVG is
aria-hidden. Each built-in entry is an<article>with an<h3>title. - The built-in date is a
<time>element without adateTimeattribute. Add one in the file if you want machine-readable dates. - Under reduced motion the beam follows the scroll exactly, without the spring.
Frequently asked questions
Can I put my own content beside the beam?
Yes. Pass children instead of items. Each direct child gets a node on the rail that fills when the beam passes it, so wrap each entry in one element.
Why is the rail empty in the server HTML?
The rail height and node positions are measured on the client, and re-measured with a ResizeObserver when the section or any entry resizes. The server renders the entries only.
Dependencies
npm
Built from
Examples
Custom entries
items take a version, a date, a title and a body; each entry gets a node that lights as the beam passes.
Your own content
Pass children instead of items and each direct child gets a node, so cards, quotes or steps all work.
Colour and rail width
color takes any CSS colour or token for the beam and nodes; rail widens the gutter the beam runs in.