Composition
ScrollShowcase
A whole feature section: a story told in steps, reveals as you scroll, and a strip of names below.
Scroll composition: StickyScrollStory + ScrollReveal + optional Marquee; all copy comes from props
- Composition
- Reduced motion: opacity-only
- 2.57 KB gzip
- Layout shift 0
Install
pnpm dlx shadcn@4.21.1 add @frictionborn/scroll-showcase
Playground
Scroll inside the frame.
import { ScrollShowcase } from "@/components/ui/scroll-showcase";
<ScrollShowcase
headline="Your section headline"
description="One sentence about it."
steps={steps}
/>In a full example
The full example loads as you scroll to it.
Accessibility
- Sections are named through aria-labelledby (the headline, and the specs heading when you pass one) or aria-label (marqueeLabel when you pass one); ids are generated per instance with useId, so two sections on one page never clash. Heading levels run h2 (headline), h2 (each step title, from StickyScrollStory), h3 (specsHeading), h4 (spec labels): place the section under an h1 and check the outline for your page. media.alt applies only to media.type 'image'. Every colour is a host token (--background, --foreground, --primary, --muted-foreground, --card, --border) with a system-colour fallback; contrast follows your theme: measured on real pixels in a fresh Next 16 app with shadcn's default tokens (sample content, light and dark, 1440 and 390 px) every text element was at least 4.7:1 (light) and 6.9:1 (dark); verify your own content.
- Keyboard: DOM order matches visual order; the only added focusable element is the marquee pause button, and focus inside the marquee pauses it
- Touch: At viewport width 768px and below the story is stacked without sticky positioning
- WCAG criteria it is built for: 2.1.1, 2.2.2, 2.4.1, 2.4.6
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
headline | string | none | Required. Primary section headline rendered as an h2. |
description | string | none | Required. Section narrative description below the headline. |
steps | StoryStep[] | none | Required. Narrative steps for StickyScrollStory ({ id, title, description, badge?, media }). |
eyebrow | string | none | Optional. Eyebrow badge above the headline. |
specs | ScrollShowcaseSpec[] | none | Optional. Specifications / highlights grid items ({ metric, label, detail }). |
specsHeading | string | none | Optional. Heading above the specifications grid. Nothing is rendered when omitted. |
specsEyebrow | string | none | Optional. Small label above the specifications heading. Nothing is rendered when omitted. |
showMarquee | boolean | true | Shows the marquee ticker when marqueeItems is non-empty. |
marqueeItems | React.ReactNode[] | none | Optional. Array of items to display in the marquee ticker. |
marqueeLabel | string | none | Optional. Label above the marquee ticker, also its accessible name. Nothing is rendered when omitted. |
smoothScroll | boolean | false | Wraps the composition in the SmoothScroll provider (off by default). |
paused | boolean | false | Universal pause prop. Passed to the reveals, the story, the marquee and SmoothScroll (the reveals only react when the browser lacks CSS scroll-driven animation). |
nonce | string | none | Optional CSP nonce forwarded to the <style> element of every item the section renders. |
className | string | none | Optional. No default. Additional CSS class names on the root container. Any other HTML attribute (id, data-*, aria-*, event handlers) is spread on the root element; handlers the item uses itself are composed, not replaced. |
style | React.CSSProperties | none | Optional. No default. Inline styles on the root container, merged last (consumer wins). |
ref | React.Ref<HTMLDivElement> | none | Receives the root <div>. |
Measured on the bench
Measured by the automated bench at commit 801163e on 2026-10-21. These numbers are written by the bench, never by hand.
| Measure | Result |
|---|---|
| Size, gzip | 2.57 KB at load, 0.02 KB loaded later |
| Layout shift | 0 |
| Frames when nothing should move | off screen 0, hidden tab 0, reduced motion 0 |
| axe accessibility scan | 0 serious, 0 critical |
Browsers it ran in
Automated Playwright runs, some with device emulation. Results from physical phones and tablets are still pending, so none are listed.
| Environment | Tier | Result | Date | Notes |
|---|---|---|---|---|
| Chromium Desktop (SwiftShader) | 3 | pass | 2026-10-21 | 19 passed, 0 failed |
| Chromium Mobile (Pixel 7 emulation) | 2 | pass | 2026-10-21 | 18 passed, 0 failed |
| Firefox Desktop | 3 | pass | 2026-10-21 | 18 passed, 0 failed |
| WebKit Desktop | 3 | pass | 2026-10-21 | 18 passed, 0 failed |
| WebKit Mobile (iPhone 14 emulation) | 2 | pass | 2026-10-21 | 18 passed, 0 failed |
On different devices
Reduced motion (opacity-only): StickyScrollStory swaps media instantly (no transition, no translation); ScrollReveal elements are immediately visible; Marquee stops animating and renders a static row (no duplicate copy, no pause button)
| Tier | What it does |
|---|---|
| T3 Full | Same as tier 2 |
| T2 Standard | Sticky story with CSS crossfades, scroll-linked or IntersectionObserver reveals, animated marquee |
| T1 Lite | ScrollReveal travel capped at 12px; Marquee still animates; layout depends on viewport width, not tier |
| T0 Static | Not gated by tier: layout stacks at viewport width 768px and below; ScrollReveal content is static; Marquee is paused with no duplicate copy |
Content Security Policy
- Works without
'unsafe-eval'. - Needs no reveal gate.
- Sets inline
styleattributes, so allowstyle-src-attr 'unsafe-inline'.