Scroll Media Expand
A cinematic scroll zoom reveal that begins as a compact media capsule, expands width-first into a rounded frame, and then fills the viewport while the surrounding text fades away. The motion is fully reversible, responsive, and driven directly by scroll progress.
Installation#
pnpm dlx shadcn@latest add @davinciui/scroll-media-expandUsage#
API Reference#
| Prop | Type | Default |
|---|---|---|
srcImage or video URL revealed through the expanding window. | string | — |
mediaTypeHow the media element is rendered. Auto detects video by file extension. | "image" | "video" | "auto" | "auto" |
posterPoster frame for video media. | string | — |
leftLabelLabel glued to the left edge of the media, pushed outward as it grows. | string | "©2026" |
rightLabelLabel glued to the right edge of the media, pushed outward as it grows. | string | "Showreel" |
overlayTextCenter CTA text revealed once the media becomes a readable card (progress ~0.32 → 0.48). | string | "Play showreel" |
objectPositionMedia focal point (CSS object-position). The container acts as a mask, so this stays stable. | string | "50% 35%" |
objectFitHow media fills its window. Cover keeps the aperture-reveal behavior with no stretching. | "cover" | "contain" | "fill" | "cover" |
initialWidthRest-state pill width in px. Defaults to a responsive clamp (150–220px desktop, 90–140px mobile). | number | — |
initialHeightRest-state pill height in px. Defaults to a responsive clamp (28–42px desktop, 22–32px mobile). | number | — |
sectionHeightHeight of the tall scroll track driving the scrub. | string | number | "300vh" |
viewportHeightHeight of the pinned viewport (any CSS length). svh avoids mobile chrome jumps. | string | "100svh" |
startRadiusCorner radius (px) of the rest-state pill. | number | 999 |
endRadiusCorner radius (px) at fullscreen. | number | 0 |
showOverlayShow the center CTA overlay. | boolean | true |
showScrollHintOptionally show a minimal scroll cue at rest that dissolves when scrolling begins. | boolean | false |
smoothingScroll-follow smoothing 0 (direct scrub) to 1. Keep at 0 so the timeline literally is the scroll position. | number | 0 |
enabledWhen false, renders a static accessible card instead of the pinned scroll effect. | boolean | true |
pauseOffscreenVideoPause video media while the section is far offscreen. | boolean | true |
pauseWhenOffscreenPause transform work while the section is far offscreen (IntersectionObserver with 600px margin). | boolean | true |
backgroundStage background. Uses the active theme token by default; pass any CSS color to override it. | string | "var(--background, #fff)" |
foregroundLabel color. Uses the active theme token by default; pass any CSS color to override it. | string | "var(--foreground, #111)" |
Accessibility#
The section is labelled, but in animated mode the image is alt empty and aria-hidden while the labels, scroll hint, and CTA are hidden from assistive tech. The CTA is not focusable. Setting enabled false renders a static card with real alt text.
Motion#
Scroll progress drives width, height, border radius, image scale, label offsets, fades, and CTA reveal with smootherstep easing; sectionHeight and smoothing control the mapping. When prefers-reduced-motion is set, the component renders a static accessible card instead.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

