shadcn.io is not affiliated with official shadcn/ui
Printed Photo Album Gallery Block for React
An open photo album on a tinted table that opens on its cover and turns like leaves onto four spreads of drawn pictures in corner mounts, with Previous and Next, a spread counter and arrow keys.
Installation
Overview
A printed album for React with Base UI, for Yearbound, a printed-album service. A centred header sits over an open album in a framed figure with + marks on its corners, lying on a tinted table. It starts open on its first spread, with the cover one Previous away; Next turns each leaf, a CSS 3D rotation of the sheet about the spine, onto the four spreads of a family year, each page holding one or two drawn pictures in corner mounts with a caption. Previous turns the leaves back, "Spread 2 of 5" says where you are, and the arrow keys, Home and End work while focus is in the album. Below md the album shows one page at a time, which settles in from the spine, and the count reads "Page 3 of 9". The pictures are drawn, not photographed: a small kit of scenes (a plate on a table, hills, a plant, a coast) in your theme's own greys, on paper that is your card colour. It's built from Button and Guides, with CSS 3D transforms and your theme's tokens for every colour. The service, the family and the places are made up for the example.
FAQ
How do I use my own pictures?
Each picture in PAGES has a title, a place, a ratio, a width (its share of the page) and a description. Add your image's address, then replace <Scene ratio={item.ratio} scene={item.scene} /> in Mounted with <img alt="" className="size-full object-cover" src={…} />. Pages come in pairs: the cover and page 1 are the two sides of the first sheet, pages 2 and 3 the second, and so on.
How does a page turn?
Every sheet is in the DOM at all times, a front and a back (the two pages it carries) on a sheet that rotates about the spine with rotateY. A sheet is turned (−180 degrees) when the spread number is higher than its own, so the state is a single number and each sheet only reads it. A sheet's stacking order flips halfway through the turn, when it is edge-on, so it never passes under its neighbour. The whole album slides half a page toward the spine's start while it is closed, so the cover sits in the middle.
How does it work with a keyboard?
Tab reaches Previous and Next; Enter or Space turns. While focus is anywhere in the album, the arrow keys step (mirrored in a right-to-left layout), Home goes to the cover and End to the last page; the album keeps its own left-to-right direction in a right-to-left page, as a printed book does, while the keys and buttons mirror. A polite line under the album says "Spread 2 of 5: Sunday supper, First walk of spring, Window sill, March", and a hidden list holds every page's pictures for a screen reader. The book itself is a drawing and is hidden from assistive technology.
How does it fit on a phone?
Below md there is no spread: the album shows one page at a time and Next and Previous move a page. The count changes to "Page 3 of 9". The page you are on stays when the window changes size, and a wider window shows the spread that holds it.
Related
- Pro
Editorial Spreads Gallery
Rows and bandsAn editorial spread you turn: three differently laid out spreads of a food-and-travel magazine, each with a drop cap, a pull quote and drawn pictures, turned with a pager or the arrow keys.
- Pro
Instant Print Gallery
Walls and tablesSix drawn instant prints lying a degree off square on a faint table band, each faded and blurred until you hover, focus or tap it, with a button that develops the whole tray one print after another.
- Pro
Card Stack Gallery
Walls and tablesA pile of five drawn risograph prints on a framed table top: send the top one to the back, or spread the pile into a row and gather it again, with a list that says the order.
- Pro
Caption Density Gallery
Rows and bandsA photo essay of five framed pictures in alternating rows, with a Short and Full switch: Short shows each title, Full adds the place, date, credit and a two-sentence story.
- Pro
Picture Timeline Gallery
Rows and bandsA vertical timeline of drawn pictures hung on a hairline through five years of a tools maker's story, with a year index that marks the year in view, jumps on choosing one and becomes a row of chips on a phone.
- Pro
Founding Artefacts About
Company storyAn about section for an invoicing studio: six founding artefacts as greyscale drawings in an asymmetric grid, each with a caption.