Sticky Scrollytelling
Keep a photo in view while alternating text cards tell the story alongside it.
- Dependencies
- No extra packages
- Size
- 132 lines
- Controls
- 5 controls
Installation
CLI · shadcn registry
npx shadcn@latest add https://ui.onycx.dev/r/sticky-scrollytelling.json1 · Dependencies
None beyond React and Tailwind.
2 · Copy the source
components/onycx/sticky-scrollytelling.tsx
Requires React 19 and Tailwind CSS v4. Copy the source from the sticky-scrollytelling.tsx tab after tweaking: your values are baked in as the new defaults. Exported image examples use portable sample artwork. Replace it with your own media as needed.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| blocks | StoryBlock[] | — | { title, body, image? } per block; an image swaps the background while that block is mid-screen. |
| image | string | "/media/ceramics-scenes/kiln-firing.webp" | Sticky background photograph (decorative). Replace with your own. |
| imageOpacity | number | 0.3 | Opacity of the background photograph. |
| blockHeight | number | 120 | Height of each story block in vh. |
| background / ink / muted | string | "#0c0a09" / "#f7f3ed" / "#d9ccb5" | Section colour (also the top and bottom fades), title and body colours. |