shadcn.io is not affiliated with official shadcn/ui
Vertical Carousel Gallery Block for React
A weaving studio's day in four pictures stacked in a framed viewer and turned up and down, beside a chapter index that marks the chapter on show and goes to any of them.
Installation
Overview
A vertical carousel for React with Base UI, for Loomhall, a weaving studio's journal. Four pictures of a day at the studio (dyeing, warping, weaving, finishing) stack top to bottom in a framed viewer at the end of a split, with Up and Down buttons and a "Chapter 2 of 4" line under it. A chapter index at the start lists the four with their time of day and one sentence each, marks the chapter on show, and each row goes straight to its picture. On a phone the viewer comes first, and the index gives way to the line under it. The pictures are drawn: a drying rack of dyed hanks, a loom with its warp, a close-up of weaving and a folded throw, in your theme's greys, light in a light theme and low-key in a dark one. It's built from Carousel, Button and Guides. The studio and its hours are made up for the example.
FAQ
How do I use my own photographs?
Each chapter in CHAPTERS has a title, a time, a summary and a scene. Replace the Scene in the slide with <img alt="" className="size-full object-cover" src={…} /> (the caption on the picture names it). The viewer is 4 wide for 5 high; change RATIO and the aspect-4/5 class together.
How does it work with a keyboard?
Tab reaches the Up and Down buttons and the chapter rows. On either button, the Up and Down arrow keys turn the viewer; on a chapter row, they move to the previous or next chapter and focus follows, so the index works like a vertical list. Enter or Space on a row goes to its picture. Down on the last chapter goes to the first, and Up on the first goes to the last.
How does the index know which chapter is showing?
The block keeps one page number. The viewer, the "Chapter 2 of 4" line (a polite live region) and the index all read it, and the row for that chapter carries aria-current and a bar at its start edge.
The block keeps Embla's API and follows its select event, so a drag on the viewer updates the index too.
What happens to the index on a phone?
It is hidden below lg, where the viewer already has the controls, and the line under the viewer names the chapter. The viewer stays 4 wide for 5 high but narrower, so the picture is never cropped.
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
Full-Width Slider Gallery
Carousels and slidesFive 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.
- Pro
3D Prism Carousel Gallery
Carousels and slidesOne stacking chair drawn from four sides on the faces of a block that turns a quarter at a time in CSS 3D, with a View control for front, side, back and top, flat under reduced motion.
- 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
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
Values Slider About
Culture and valuesA carousel of six values for an HR platform, one per slide in a band from rail to rail: the value, a practice example and one figure side by side, with Previous and Next buttons, a counter and dots.