Skip to content

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.

src/registry/blocks/scroll-story.tsx/r/scroll-story.json

Installation

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

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/scroll-story.json

Usage

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

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

API reference

ScrollStory props
PropTypeDefault
eyebrowSmall mono label above the title. Empty string hides it.string"How it works"
titleSection heading (rendered as h2).React.ReactNode"Live in an afternoon."
stepsSteps in order. Defaults to Lumen's connect, learn, tell story.Step[]STEPS
classNamestring-

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.

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.

Frequently asked questions

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.

Dependencies

npm

lucide-reactmotion

Built from

No other MiniDev files
All Landing page sections for React and Tailwind

Learn more