shadcn.io is not affiliated with official shadcn/ui
Infinite Marquee Gallery Block for React
Two rows of drawn prints moving in opposite directions under a centred header, landscapes in one and tall portrait prints in the other, with faded ends, titles that link, a visible Pause and hand scrolling under reduced motion.
Installation
Overview
A moving gallery for React with Base UI, for Wanderwick, a travel zine. A centred header sits over two bands, each on a top rule with + marks at the page rails: landscape prints three by two drift one way, tall portrait prints two by three drift the other, both fading out at their ends. Each print is a drawn picture with its title as a link and its place and year under it. A visible Pause button under the header stops both rows; hovering a row, or focusing a title in it, holds that row. Under reduced motion nothing moves, the Pause button is not shown and each row scrolls by hand. The looping copies are hidden from screen readers and out of the tab order, so the page lists each print once. The pictures are drawn, not photographed: a small kit of scenes in your theme's own greys, each a few lines of data you swap for your photographs. It's built from Marquee, Button and Guides, with your theme's tokens for every colour. The zine, places and titles are made up for the example.
FAQ
Can a visitor stop the rows?
Yes. The Pause scrolling button above the rows sets both to paused and keeps aria-pressed, with a play icon while paused. Hovering a row or putting keyboard focus on a title in it also holds that row, so a visitor can read a caption or follow a link without chasing it. Under reduced motion the animation never starts, so the button is hidden.
Does a screen reader hear every print twice?
No. The row repeats its prints to fill the width, and every repeat after the first is hidden from assistive technology and marked inert, so it is not in the tab order either. A reader meets each of the twelve prints once, as a figure with its title and place.
What happens with reduced motion?
Nothing moves by itself. The looping copies are hidden, the edge fade is dropped so the first and last prints are not covered, and each row becomes an ordinary horizontal scroller: swipe or scroll it, or tab through the titles, which scroll into view. The Pause button goes away with the motion.
How do I change the speed or the direction?
Each PrintRow takes speed and reverse. The two rows use different speeds on purpose, so they never line up. Their prints are two lists at the top of the file (LANDSCAPES and PORTRAITS): add or remove a print and the row refills itself.
How do I use my own photographs?
Each print in the lists has a title, a place, a year and a description. Add your image's address to it, and replace the Scene in print() with <img alt="" className="size-full object-cover" src={…} />: the frame keeps the three by two or two by three shape and the caption names the picture. The comment above Scene says where.
Related
- Pro
Dual Scroll Gallery
Rows and bandsA tall framed window beside the copy where two columns of drawn leather goods scroll in opposite directions, with faded ends, a visible Pause and three facts about the workshop at the foot of the copy.
- Pro
Ken Burns Slideshow Gallery
Carousels and slidesA framed viewer that runs rail to rail with five drawn stills, each panning and zooming slowly for seven seconds before crossfading to the next, with a caption, segments that fill with the time, Previous, Next and a visible Pause.
- Pro
Dual Marquee Awards
Strips and bannersTwo rows of award pills moving in opposite directions, each with a drawn mark, the award, the programme and the year, and a visible pause button.
- Pro
Dual Row Marquee Logos
Multi-row marqueesTwo rows of customer wordmarks for a camera-security service, scrolling in opposite directions at one calm speed under a centred header, with a button that pauses both.
- Pro
Scroll Marquee Banner
TickersA news ticker for a developer platform on a tinted strip: a Latest label, a labelled Pause button, and eight headline links with a bold lead scrolling past.
- Pro
Lightbox Gallery
Stage and thumbnailsNine pictures of a photography studio's year on shared hairlines, a featured frame and a caption under each, where every frame opens one viewer dialog with the whole picture, its credit, Previous and Next, a counter, arrow keys and a swipe.