# Tracing Beam

> A 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.

- Kind: Motion component (Motion)
- Docs: https://ui.minidev.pro/docs/tracing-beam
- Source (registry JSON with the full file): https://ui.minidev.pro/r/tracing-beam.json
- License: MIT. One file, yours to edit after install.

## 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.

## Installation

### shadcn CLI (copies the source into your project)

```bash
npx shadcn@latest add @minidev/tracing-beam
```

Writes `components/ui/tracing-beam.tsx` and installs its npm dependencies. Older CLI versions: `npx shadcn@latest add https://ui.minidev.pro/r/tracing-beam.json`.

### npm package

```bash
npm i minidev-ui-kit motion
```

Add the tokens to your global stylesheet once:

```css
@import "tailwindcss";
@import "minidev-ui-kit/styles.css";
@source "../node_modules/minidev-ui-kit";
```

Next.js also needs `transpilePackages: ["minidev-ui-kit"]` in next.config.

## Import

After the shadcn install:

```tsx
import { TracingBeam } from "@/components/ui/tracing-beam"
```

From the npm package:

```tsx
import { TracingBeam } from "minidev-ui-kit/premium/tracing-beam"
```

## Usage

```tsx
import { TracingBeam } from "@/components/ui/tracing-beam"

export function Example() {
  return (
    <TracingBeam />
  )
}
```

## Props

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `items` | `TracingBeamItem[]` | `DEFAULT_ITEMS` | no | Entries to trace. Each one gets a node on the beam. |
| `children` | `React.ReactNode` | - | no | Your own content in place of the entries. Each direct child gets a node. |
| `color` | `string` | `"var(--accent)"` | no | Beam colour. Any CSS colour, including var(--token). Defaults to the accent. |
| `rail` | `number` | `40` | no | Width of the rail the beam runs in, in pixels. |
| `className` | `string` | - | no |  |

## 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.

```tsx
<TracingBeam
  items={[
    { version: "v2.4", date: "10 Oct 2026", title: "Payout schedules", body: "Pay suppliers on the day you choose. Northwind batches 40 payouts every Friday and Lumen files the remittance advice for each one." },
    { version: "v2.3", date: "18 Sep 2026", title: "Approvals by amount", body: "Anything under 5,000 routes to Priya Raman and larger spends wait for Sam Lowe. Every decision is logged with who, when and why." },
    { version: "v2.2", date: "02 Sep 2026", title: "Bank feeds for 1,200 banks", body: "Transactions land within minutes and match to open invoices by amount, reference and payer. Misses go to a review queue." },
  ]}
/>
```

### Your own content

Pass children instead of items and each direct child gets a node, so cards, quotes or steps all work.

```tsx
<TracingBeam>
  <div className="rounded-xl border border-border bg-surface p-4 shadow-raised">
    <p className="text-sm font-medium text-fg">Invoice sent</p>
    <p className="mt-1 text-xs text-fg-muted">INV-2041 to Northwind Traders, $1,840, 3 October</p>
  </div>
  <div className="rounded-xl border border-border bg-surface p-4 shadow-raised">
    <p className="text-sm font-medium text-fg">Opened</p>
    <p className="mt-1 text-xs text-fg-muted">Maya Chen viewed it twice, 4 October</p>
  </div>
  <div className="rounded-xl border border-border bg-surface p-4 shadow-raised">
    <p className="text-sm font-medium text-fg">Reminder sent</p>
    <p className="mt-1 text-xs text-fg-muted">In your voice, 11 October</p>
  </div>
  <div className="rounded-xl border border-border bg-surface p-4 shadow-raised">
    <p className="text-sm font-medium text-fg">Paid in full</p>
    <p className="mt-1 text-xs text-fg-muted">Matched to the bank line, 12 October</p>
  </div>
</TracingBeam>
```

### Colour and rail width

color takes any CSS colour or token for the beam and nodes; rail widens the gutter the beam runs in.

```tsx
<TracingBeam
  color="var(--success)"
  rail={64}
  items={[
    { version: "v3.0", date: "02 Aug 2026", title: "Workspaces and roles", body: "Every company gets its own workspace with owners, approvers and viewers. Audit history records who changed what and when." },
    { version: "v2.9", date: "14 Jul 2026", title: "Statements on a schedule", body: "Monthly statements go out to every customer with an open balance, and stop once the balance is cleared." },
  ]}
/>
```

## 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 a `dateTime` attribute. Add one in the file if you want machine-readable dates.
- Under reduced motion the beam follows the scroll exactly, without the spring.

## FAQ

### 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.

## Rules for generating code

- Use semantic tokens only (bg, surface, sunken, border, fg, fg-muted, fg-subtle, ink, accent, success, warning, danger). Never raw hex or palette steps like blue-500.
- Shadows only from the set: shadow-xs, shadow-sm, shadow-raised, shadow-md, shadow-lg, shadow-overlay.
- Numbers use tabular-nums. Dark mode is the `dark` class on <html>; components never branch on theme.

## Dependencies

- npm: `motion`

## Related

- [Timeline](https://ui.minidev.pro/docs/timeline/md): Tailwind vertical timeline with a hairline rail, a dot per event, titles, optional descriptions and right-aligned timestamps for activity feeds and changelogs.
- [Sticky Feature Story](https://ui.minidev.pro/docs/sticky-feature-story/md): A sticky scroll section where the active step highlights as you scroll and a pinned preview swaps with a step counter. Pass your own steps as props.
- [Scroll Chapter Story](https://ui.minidev.pro/docs/scroll-chapter-story/md): A scroll story of three chapters that slide in as you scroll, with a sticky progress bar that fills with scroll position across the whole section.
- [Animated Feature Row](https://ui.minidev.pro/docs/animated-feature-row/md): A row of feature cards that slide up with a staggered delay when scrolled into view. Pass title and description pairs; reduced motion keeps them still.
- [Card Tilt](https://ui.minidev.pro/docs/card-tilt/md): A card that tilts in 3D toward the pointer on springs, with an accent glare that follows the cursor. It stays flat when reduced motion is preferred.
- [Cursor Spotlight Panel](https://ui.minidev.pro/docs/cursor-spotlight-panel/md): A panel whose accent radial spotlight follows the cursor, driven by Framer Motion values without re-renders. It shows a still surface for reduced motion.

---

All 557 components: https://ui.minidev.pro/llms.txt (full text: https://ui.minidev.pro/llms-full.txt).
