shadcn.io is not affiliated with official shadcn/ui
Recommended bookshelf About Block for React
A bookshelf for a reading app: greyscale spines you can point at, focus or press, each pulling forward to show why the company recommends it and who did.
Installation
Overview
A bookshelf for React with Base UI, written for Bookmoth, a fictional reading app. Eight spines stand on a framed shelf, titles set vertically, each a different height and a different greyscale pattern. Point at one, move focus onto it, or press it, and it pulls forward. Under the shelf, "Why we recommend it" names the reason and the person who recommended it. The shelf scrolls when the row is wider than the screen, and every recommendation stays in the page. The page's rails and top rule come from the Guides spine. It's built from ToggleGroup and Guides, with a CSS entrance and your theme's tokens for every colour. For an about page that should hand someone a book the company actually loves. The books, the reasons and the people are example data.
FAQ
How do I change the books?
The books are BOOKS at the top of the file. Each has a title, a why, a by and a role, plus a height class and a pattern class for the spine. The heading counts BOOKS. The first book starts selected. Add or remove rows freely: the shelf, the scroll and the note are drawn from the array.
How is it read by a screen reader?
The heading is the section's only h2. The shelf is a group named "Books we recommend", and each spine's name is its title. Under the shelf, one h3 ("Why we recommend it") introduces the reason and who recommended it. The other reasons stay in the page but are hidden from assistive technology until that spine is chosen. After you choose a different book, a polite live region repeats the reason. The lines and the plank are hidden from assistive technology.
How do I choose a book?
Pointing at a spine, moving focus onto it, or pressing it selects that book and pulls the spine forward. The selected book stays selected: pressing it again does not clear it. The note under the shelf updates to that book's reason.
Are the other recommendations in the HTML?
Yes. All eight reasons are in the page. The ones you are not looking at are invisible, so the note does not change height, and they are removed from the tab order and from the accessibility tree.
Related
- Pro
Podcast Show Notes About
Press and recognitionShow notes for a podcast hosting company's own show: a scrolling vertical list of eight episodes at the start and the chosen episode's notes at the end, with a summary, chapters drawn to scale and listed with time stamps, and a Listen link.
- Pro
Citable Publications About
Press and recognitionA bibliography for a research platform: eight publications as a numbered list in citation form, a type filter, and a Cite button on each row that copies the reference.
- Pro
Paper Viewer About
Press and recognitionA paper viewer for a lab data platform: a vertical list of five papers at the start and the chosen paper drawn as a framed page at the end, with its venue, title, authors, abstract and one key figure.
- Pro
Magazine Front Blog Highlights About
Press and recognitionThe front page of a newsletter platform's blog laid out like a magazine: a category filter, a featured story with a drawn typographic cover, two small stories and a wide one, and the other categories dimmed when one is chosen.
- Pro
Timetable Day in the Life About
Culture and valuesOne person's Tuesday as a timetable: three lanes (Focus, Meetings, Support) over the working day, with blocks you pick to read what each one was for.
- Pro
Values Cloud About
Culture and valuesA cloud of nine values for a writing app, sized by how often each wins when two disagree: pick a pill in a framed tray and a band under it says what the value means and what it costs us.