shadcn.io is not affiliated with official shadcn/ui
Featured Carousel Reviews Block for React
A framed carousel of five editor's picks for a desk chair, each chosen by a rule worked out from ten typed reviews: most helpful, most detailed, best critical, newest verified and longest owned.
Installation
Overview
An editor's-picks carousel for React with Base UI, for the Peltline Ergo 2, a fictional desk chair. A centred header holds the title and one sentence over a framed carousel: a tinted shell with a + mark on each corner and, inside, a raised card per slide. The five slides are chosen by rules worked out from the ten typed reviews, not by hand: the most helpful, the most detailed (the most words), the best critical review (the most helpful of the 1 and 2 star reviews), the newest verified one and the one from the longest owner. A rule never takes a review an earlier rule took. Each slide names its rule in a badge, says the fact that won it ("37 readers found it helpful"), then shows the full review: stars with their value in words, a title, the text, the reviewer with an initials avatar, a "Verified purchase" mark in words, a fixed date and how long they owned the chair. Previous and Next buttons, a dot per pick and the arrow keys move the carousel, a line says "Pick 3 of 5" and a screen reader hears it politely after the first move. Nothing advances by itself. On a phone the next slide peeks in at the edge. It's built from Carousel, Rating, Badge, Avatar, Button and Guides.
FAQ
How are the five picks chosen?
RULES at the top of the file lists them in the order the slides show: each has a label, an eligible test and a score. The winner of a rule is the highest score among eligible reviews that no earlier rule took, and a tie goes to the newer review. Change a rule, or add one, and the slides, the dots and "Pick 3 of 5" follow. The sentence on each slide ("Written after 14 months with the chair") is built from the winning review's own numbers.
How do I use my own reviews?
Replace REVIEWS, newest first. Each review has an id, name, rating, an ISO date, a title, a body, helpful (votes), owned (months) and verified. Keep at least one review that is verified, one of 2 stars or fewer, and enough that five different reviews can win; otherwise a rule can have nothing eligible left.
How does the carousel move?
It never plays on its own. Press Next, Previous, a dot, or the arrow keys on the slides or either button; the arrows follow the page's direction. Slides that are out of view are inert and hidden from screen readers, so only the current one can be focused or read, and the position is announced once as "Pick 3 of 5, Newest verified".
The Carousel is Embla: the block holds its api, reads selectedScrollSnap on select, and scrolls with scrollTo; each slide is a labelled group.
Related
- Pro
Pinned Featured Reviews
Merchant toolsThree numbered pin slots for a bookshelf's reviews: pin from a list, move a pin up or down, unpin it, or replace a full slot through a Select.
- Pro
Snippet Cards Reviews
Cards and wallsEight review snippet cards on shared hairlines for a yoga mat: each leads with its most helpful sentence, and a Sheet opens the whole review with Previous and Next buttons and a polite counter.
- Pro
Range Slider Testimonial Reviews
Cards and wallsA two-thumb star range picks which of a camera bag's 13 reviews you read, one full review at a time, with Previous and Next buttons, the arrow keys and a Review 2 of 10 counter.
- Pro
Quote Carousel Testimonials with Next-Speaker Preview
Carousels and decksA centred, looping carousel of large customer quotes in a card in a card, whose Previous and Next buttons preview who speaks next, with the neighbour's avatar and first name.
- Pro
Helpful Votes Reviews
Votes and repliesThe best favourable and the best critical review of a water filter jug side by side, each with a Helpful vote and a worked-out 'n of m found this helpful', above the other reviews in ruled rows with a most-helpful or newest order.
- Pro
Pin a Quote Testimonials
Expand, flip, pinFour quote rows in a ruled list with Pin toggles: the pinned quote moves up into a large featured card, a raised panel in a tinted shell with + marks, split from the list by a solid divider, under a compact header with a Shine Button.