# TracingBeam

> A reading lamp on a rail beside long-form content: it trails the reader's eye on a spring, leaves what has been read softly lit, and ticks off each heading as it passes.

- Package: `fancy-ui-svelte` (Svelte 5 + Tailwind CSS v4)
- Category: Effects
- Tags: scroll, animation, beam, progress, reading, sidebar, headings
- Docs: https://fancy-ui.rama.app/docs/components/tracing-beam
- Source: https://github.com/RamaHerbin/fancy-ui/tree/main/src/lib/fancy-ui/tracing-beam

## Import

```svelte
<script lang="ts">
  import { TracingBeam } from 'fancy-ui-svelte';
</script>
```

Setup (once per project): `npm install fancy-ui-svelte`, then add `@import "fancy-ui-svelte/tailwind.css";` after `@import "tailwindcss";` in your main CSS file. Full guide: https://fancy-ui.rama.app/llms.txt

React: `import { TracingBeam } from 'fancy-ui-react';` (`class` becomes `className`, snippets become `ReactNode`, DOM callbacks are camel-cased; exact names on https://fancy-ui.rama.app/docs/components/react/tracing-beam.md).

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `accent` | `string` | `undefined (follows --primary, falls back to oklch(0.7 0.13 285))` | Colour of the lamp, its trail and the lit markers. Any CSS colour; also settable via the --tracing-beam-accent CSS variable. |
| `readingLine` | `number` | `0.38` | Where the reader's eye is assumed to be, as a fraction of the viewport height from the top. The lamp sits on that line, clamped to the content. |
| `markers` | `boolean` | `true` | Draw a marker on the rail for every heading (h1–h4) inside the content, or for every direct child when there is none. Markers light up as the lamp passes them. |

## Snippets

| Snippet | Description |
| --- | --- |
| `children` | Long-form content the beam reads alongside |

## Examples

### Basic Usage

```svelte
<script lang="ts">
	import { TracingBeam } from "fancy-ui-svelte";
</script>

<TracingBeam>
	<div class="max-w-2xl space-y-16">
		<div>
			<span class="mb-2 block text-xs font-semibold tracking-wider text-emerald-500 uppercase"
				>v0.1</span
			>
			<h2 class="mb-3 text-xl font-semibold">The First Sketch</h2>
			<p class="text-muted-foreground leading-relaxed">
				It started as a folder of throwaway components and a single button that looked good in every
				theme. No tokens, no docs site, just a designer and an engineer arguing about border radius
				until 2am. That argument became the first commit.
			</p>
		</div>

		<div>
			<span class="mb-2 block text-xs font-semibold tracking-wider text-purple-500 uppercase"
				>v0.5</span
			>
			<h2 class="mb-3 text-xl font-semibold">Everything Learns to Move</h2>
			<p class="text-muted-foreground leading-relaxed">
				Static components gave way to a proper motion layer: spring-based transitions, shared layout
				animations, and a reduced-motion fallback for every single one of them. This is also when
				the team agreed on a rule that stuck — nothing animates without a reason.
			</p>
		</div>

		<div>
			<span class="mb-2 block text-xs font-semibold tracking-wider text-blue-500 uppercase"
				>v1.0</span
			>
			<h2 class="mb-3 text-xl font-semibold">Launch Day</h2>
			<p class="text-muted-foreground leading-relaxed">
				The API stabilized, the docs got real examples instead of placeholders, and the changelog
				finally had a version worth calling stable. Version 1.0 shipped quietly on a Tuesday, which
				felt right for something that took over a year of small decisions to get there.
			</p>
		</div>
	</div>
</TracingBeam>
```
