shadcn.io is not affiliated with official shadcn/ui
Full-Width Slider Gallery Block for React
Five architecture projects as 21:9 slides from rail to rail with a masked caption, a numbered thumbnail rail as the navigation, loop and autoplay with a visible Pause that never runs under reduced motion.
Installation
Overview
A full-width slider for React with Base UI, for Voussoir Architects, an architecture practice. Five projects run as 21:9 slides from rail to rail (16:9 on a phone), the title, place and year laid over a masked foot of each picture. Under the slider a numbered thumbnail rail is the navigation: each thumbnail goes to its project, and a thin bar under the current one fills over six seconds and is the timer that turns the slider on. A Pause toggle stops it, and so does keyboard focus inside the slider; with reduced motion it starts paused. Previous and Next buttons and the arrow keys move by hand, and the slider loops. On a phone the rail is a snap scroller. The pictures are drawn: a brick facade, an atrium, a bridge, a tower and a floor plan in your theme's greys. It's built from Carousel, Toggle, Button and Guides. The practice and its projects are made up for the example.
FAQ
How do I use my own photographs?
Each project in PROJECTS has a title, a place, a year, a sentence and a scene. Replace the Scene in the slide and in the thumbnail with <img alt="" className="size-full object-cover" src={…} />. Slides are 21 wide for 9 high (RATIO, aspect-[7/3]) and 16:9 on a phone, and the picture is cropped to fit, so keep the subject near the middle.
How does the autoplay work, and how do I stop it?
The bar under the current thumbnail is a CSS animation, and when it ends the slider goes to the next project, so the timer and the pause can never drift apart. The Pause toggle (pressed means paused) holds the animation, keyboard focus inside the slider holds it too, and the pointer does not. Under reduced motion it starts paused and only the toggle starts it. To change the pace, change the 6s in FILL.
How does it work with a keyboard?
Tab reaches the Pause toggle, Previous, Next and each thumbnail; the arrow keys on any of them step through the projects (mirrored in a right-to-left layout), and Enter or Space on a thumbnail goes to it. Moves you make by hand are announced ("Calder Footbridge, Calder Reach, project 3 of 5"); the timer's moves are not, so a screen reader is not interrupted.
Does it loop?
Yes. Next on the last project goes to the first and Previous on the first goes to the last, so no button disables under focus. Off-screen slides are hidden from the tab order and from screen readers.
Embla runs with loop: true and the block follows its select event.
Related
- Pro
Carousel Gallery
Carousels and slidesNine drawn trail pictures in a ruled band for a trail-guide app, three wide with the next one cut off at the rail, turned with buttons, dots and the arrow keys, under a heading row with a live counter.
- 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
Thumbnail Strip Gallery
Stage and thumbnailsA viewer for a lighting shop: a framed 4:3 stage with Previous and Next, its caption beside it, and a scrollable strip of twelve thumbnails whose arrow keys step through the pictures.
- Pro
Band Layout Gallery
Rows and bandsFour full-width cinematic bands of one drawn valley at dawn, noon, dusk and night, each drifting as it crosses the screen, with a caption and a Read the note disclosure under every band.
- Pro
Carousel Slider Features
Carousels and mediaA one-slide-at-a-time carousel of the five steps of making a deck, each a checklist beside a greyscale drawing, with a segmented progress bar of labelled segments as the navigation.
- Pro
Rotating Carousel Banner
Disclosures and tabsA rotating announcement for a design-system library in a framed figure: three slides cross-fade in one place, with a Pause button, pause on hover and focus, and dots that name their slide.