# Scroll Story

> A scrollytelling section: steps scroll on one side while a pinned visual swaps as each reaches mid screen and a progress rail fills. Inline on mobile.

- Kind: Block (Landing pages)
- Docs: https://ui.minidev.pro/docs/scroll-story
- Source (registry JSON with the full file): https://ui.minidev.pro/r/scroll-story.json
- License: MIT. One file, yours to edit after install.

## When to use

Use for a 3–5 step explanation on a landing page. On large screens the visual is sticky; below lg each step shows its own visual inline, so nothing is lost on mobile. Each `visual` should be a compact panel (a DeviceFrame scaled down, a card). Swaps are instant under reduced motion. For a static grid of features use BentoLive.

## Installation

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

```bash
npx shadcn@latest add @minidev/scroll-story
```

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

### npm package

```bash
npm i minidev-ui-kit lucide-react 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 { ScrollStory } from "@/components/ui/scroll-story"
```

From the npm package:

```tsx
import { ScrollStory } from "minidev-ui-kit/blocks/scroll-story"
```

## Usage

```tsx
import { ScrollStory } from "@/components/ui/scroll-story"

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

## Props

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `eyebrow` | `string` | `"How it works"` | no | Small mono label above the title. Empty string hides it. |
| `title` | `React.ReactNode` | `"Live in an afternoon."` | no | Section heading (rendered as h2). |
| `steps` | `Step[]` | `STEPS` | no | Steps in order. Defaults to Lumen's connect, learn, tell story. |
| `className` | `string` | - | no |  |

## Accessibility

- The section is labelled by its `<h2>` through `aria-labelledby`, and each step title is an `<h3>`.
- Each visual is shown once at a time: inline below `lg`, and in the pinned panel from `lg` up, where the inline copies are `display: none`.
- The progress rail and step dots are `aria-hidden`. Under reduced motion the rail jumps, the panel swaps with no blur or rise, and the panel rows skip their entrance.

## FAQ

### How does it decide which step is active?

An `IntersectionObserver` with `rootMargin: "-45% 0px -45% 0px"` marks a step active when it crosses the middle tenth of the viewport. Each step is at least `60vh` tall, so only one is in that band at a time.

### Does it work inside a scrolling panel or modal?

Not as expected. The observer has no `root`, so it watches the browser viewport, not an `overflow-auto` container. Use it in the page's main scroll.

### Can I control the active step or listen for changes?

No. There is no `value` or change callback. The active step comes only from scroll position, and the pinned visual swaps to that step's `visual`.

## 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: `lucide-react`, `motion`

## Related

- [Device Frame](https://ui.minidev.pro/docs/device-frame/md): Wraps any React UI in a phone with notch, status bar and side buttons, or a browser window with a URL bar. Built from theme tokens for light and dark.
- [Bento Live](https://ui.minidev.pro/docs/bento-live/md): A React bento feature grid where each tile runs a live demo: a rolling MRR counter, a typed AI answer, ranked alerts and an orbiting integrations ring.
- [Changelog Page](https://ui.minidev.pro/docs/changelog-page/md): A Tailwind changelog card listing releases with a monospace version, tag badge, date, title and summary, separated by hairline dividers.
- [Cta Band](https://ui.minidev.pro/docs/cta-band/md): A closing CTA section with a large lit headline and an inline email form whose button animates from idle to sending to a success check. Async onSubmit.
- [Faq Section](https://ui.minidev.pro/docs/faq-section/md): An FAQ section with a heading column and an accessible accordion: one answer open at a time, arrow key navigation, aria-expanded and smooth row animation.
- [Hero Spotlight](https://ui.minidev.pro/docs/hero-spotlight/md): A launch hero with a pulsing eyebrow, blur-in headline with a cursor lit second line, two actions, a proof line and a product visual that tilts into place.

---

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