shadcn.io is not affiliated with official shadcn/ui
Stack Overlap Scroll Testimonials Block for React
Quotes from teams on a developer platform that pile up as you scroll: each note is a full-width band between the rails with its own top rule and + marks, every band sticks near the top and the next slides over it, leaving each covered band's name strip visible. A Shine Button sits in the header.
Installation
Overview
Let the page do the stacking, in a testimonials block for React with Base UI. A compact header (Notes from teams shipping on Mooring, a fictional developer platform) carries a Shine Button at its end. Under it, four notes run down the page as full-width bands between the page's rails, each with its own top rule and + marks where it meets them. As you scroll, each band sticks near the top of the screen and the next one slides up over it, so the bands pile into a staircase: the earlier ones are covered, but each leaves a strip with the author's name, role and company showing above the band on top. Every band is a name strip, the quote in large type and a topic Badge, with an Avatar with initials. It's pure CSS sticky positioning: no scroll listeners, no motion library and no hidden copies, with your theme's tokens throughout. The block ends on its last band, so the next section draws the closing rule. For long landing pages that want a few strong quotes to feel like a moment instead of a grid.
FAQ
How do I change the quotes or add a fifth note?
Edit the TESTIMONIALS array at the top of the file: each entry has an author, role, company, two-letter initials, a topic for its badge and the quote. The numbering ("01 / 04") follows the length of the array. Each band sticks at its own offset from the STICK list, one name strip lower than the band before it, so a fifth note needs a fifth entry there (top-52).
How does the stacking work?
Every band is a list item with position: sticky, an opaque background and a top offset that grows by one name strip (3rem) per band. While you scroll, each band holds at its offset until the list ends, and the next band, which keeps moving, slides over it. A band's name strip is exactly one strip tall, which is why it stays visible when the next band covers the rest. Before you scroll, the bands simply read as a list. The section clips only sideways (overflow-x: clip), which doesn't break sticky.
Why doesn't it stack inside my layout?
Sticky positioning stops working when any ancestor scrolls its content, so the list and the sections above it must not have overflow: hidden, auto or scroll. The block's own section uses overflow-x: clip, which is safe. Put the block directly in the page, or in a container that doesn't scroll or clip.
What do screen readers and keyboards get?
Nothing is hidden: the list is an ordered list of four figures in reading order, each with its author in the figcaption and its quote in a blockquote, so every quote is read in full even while another band covers it. The band number and the + marks are decorative and hidden. The only control is the Shine Button in the header.
What changes when a visitor prefers reduced motion?
The header and the list appear without fading in, and the Shine Button's light fades in instead of sweeping. The stacking itself is the browser's own scrolling, so it follows the visitor's scroll position with no animation of its own to turn off.
How does it fit on a phone?
The bands are one column at every width, and the quote steps down a size on phones. On a narrow screen the name strip truncates the role and company before it would wrap, so the strips always keep their height, and the quote text wraps inside its band. The stack has to fit in the viewport, so with more than four or five notes on a short phone screen, reduce the strip height first.
Related
- Pro
Layered Quote Deck Testimonials
Carousels and decksA deck of four customer quote cards in a framed figure under a centred header: the front card sits on two peeking cards, and the Shine Button sends it to the back so the deck cycles.
- Pro
Triple Stack Vertical Carousel Testimonials
Carousels and decksA vertical carousel with three customer quotes in view: each press of the up or down button moves one row, with a count of which quotes are showing.
- Pro
Rotating 3D Wheel Testimonials
Carousels and decksA 3D wheel of customer quotes in a framed figure under a centred header: the active quote faces you flat while its neighbours tilt away above and below, and up and down buttons in a footer strip turn the drum.
- Pro
Centered Stacked Cards Deck Hero
Product windowsA centred showcase hero for a reporting workspace: the headline and a Shine Button, then a band between the rails with a fanned deck of three app windows (Dashboard, Analytics, Reports) that runs off its foot, masked.
- Pro
Stacked Cards Pricing
Plan cardsA fanned deck of plan cards for a flashcard app: the chosen plan's card in front with its price, button and features, the other two peeking out behind, brought forward by a tab list.
- Pro
Accordion Testimonials
Rows and listsCustomer stories as accordion rows beside a side header, on the page's drafting lines: each row shows the person, a one-line summary and a rating, and opens one at a time to read the full quote.