Horizontal scroll section
Also called horizontal scrolling section or sideways scroll
A pinned section where scrolling down moves a row of cards sideways, turning vertical scrolling into horizontal movement.
import { useRef } from 'react';
import { motion, useScroll, useTransform } from 'motion/react';
const caseStudies = [
{ name: 'Northwind', result: 'Cut checkout time by 38%' },
{ name: 'Fieldnote', result: 'Shipped a mobile app in two weeks' },
{ name: 'Harbor', result: 'Moved 12 internal tools online' },
{ name: 'Parcel', result: 'Doubled weekly signups' },
{ name: 'Lumen', result: 'Replaced six spreadsheets with one app' }
];
export function CaseStudyScroller() {
const track = useRef<HTMLDivElement>(null);
const { scrollYProgress } = useScroll({
target: track,
offset: ['start start', 'end end']
});
// Slide the row left by its overflow: its own width (100%) minus the viewport's.
const x = useTransform(
scrollYProgress,
(p) => `calc(${-p} * (100% - 100vw))`
);
// Tabbing to an off-screen card scrolls the page to the point where it's in view.
function reveal(index: number) {
const { top, height } = track.current!.getBoundingClientRect();
const progress = index / (caseStudies.length - 1);
window.scrollTo({ top: scrollY + top + progress * (height - innerHeight) });
}
return (
// About as tall as the row is wide, so the row moves at a natural scrolling speed.
<div ref={track} className='relative h-[300vh]'>
<div className='sticky top-0 flex h-screen flex-col justify-center gap-8 overflow-clip'>
<motion.ul style={{ x }} className='flex w-max gap-6 px-6'>
{caseStudies.map((study, index) => (
<li key={study.name}>
<a
href={`/customers/${study.name.toLowerCase()}`}
onFocus={(event) =>
event.currentTarget.matches(':focus-visible') && reveal(index)
}
className='flex h-80 w-90 flex-col justify-end gap-1 rounded-3xl bg-muted p-6'
>
<span className='text-muted-foreground'>{study.name}</span>
<span className='text-xl font-semibold'>{study.result}</span>
</a>
</li>
))}
</motion.ul>
<motion.div
aria-hidden='true'
style={{ scaleX: scrollYProgress }}
className='mx-6 h-1 origin-left rounded-full bg-foreground'
/>
</div>
</div>
);
}Turn the case studies into a horizontal scroll section: wrap them in a container about 300vh tall, pin an inner panel with position: sticky; top: 0; height: 100vh, and translate the row of 360px cards from 0 to -(row width - viewport width) as the reader scrolls through the wrapper. Show a thin progress bar under the cards, keep the cards in Tab order, and fall back to a swipeable row with scroll-snap on screens under 768px.
Paste into Layerwise or any AI coding tool.
What is Horizontal scroll section?
In a horizontal scroll section, the page pins a wide row of content and slides it left as the reader scrolls down. A timeline, a set of case studies, or a product lineup moves past as if the page turned a corner, then normal vertical scrolling resumes at the end.
It is built like scroll pinning: a tall wrapper, a sticky child one screen tall, and a row inside it that moves with translateX from 0 to minus its overflow width as scroll progress goes from 0 to 1. Make the wrapper roughly as tall as the row is wide so the movement keeps a natural scrolling speed.
Readers can’t tell that more content waits off to the side, so let the next card peek in and show a progress indicator. Keyboard and screen reader users still need to reach every card in order, and on phones a swipeable row with scroll-snap is often the simpler choice.
Often confused with
- Carousel
- A carousel moves sideways when you swipe or press its arrows. A horizontal scroll section moves sideways as you scroll down the page.
Related terms
All termsScroll pinning
A scroll effect that holds a section in place while its content animates through several states, then releases it to scroll away.
Carousel
A row of slides shown one at a time and moved with arrows, dots, swipes, or a timer, to fit several images or cards in one spot.
Scroll snap
A CSS feature that makes a scroll container settle on set points, so carousels and full-screen sections come to rest neatly on an item.
Marquee
A strip of logos or text that scrolls sideways in an endless loop, often used for "trusted by" rows and announcements.




