shadcn.io is not affiliated with official shadcn/ui
Criterion Picker Multi-Criteria Reviews Block for React
Reviews that each score five criteria, with a picker that sorts the list by one criterion and shows every criterion's average, and the five scores of each review drawn as dots.
Installation
Overview
A multi-criteria reviews block for React with Base UI, for the Heronworth Calm 200, a fictional air purifier. A compact header sits over a split behind a divider. At the start, a criterion picker offers six choices (Overall, Quiet, Airflow, Filter life, App and Value), each with the average of all ten reviews for it; on a phone it becomes a row that scrolls sideways. At the end, the four reviews that score the chosen criterion highest, each with its reviewer, read-only stars, title and text and a list of its five criterion scores drawn as dots, with the chosen criterion in bold. Picking a criterion sorts the reviews on the spot and a polite line says what is showing. Every average is worked out from the ten typed reviews at the top of the file. It's built from Toggle Group, Rating, Avatar and Guides.
FAQ
How are the reviews sorted?
By the chosen criterion's score, highest first; a tie goes to the newer review, then to the id. Overall sorts by each review's own star rating. The list shows the top four of the ten, so the reviews that appear change with the criterion. The picker's averages cover all ten, not only the four shown.
How do I change the reviews or the criteria?
Each entry of REVIEWS has its stars, five scores in the order of CRITERIA, and the text. Add a criterion to CRITERIA and a number to every review's scores; the picker, the averages and the dots follow. Keep the reviews' text to about two lines, since the rows reserve that height so the list does not jump when the order changes.
How does the picker work with the keyboard?
It is a single-choice group of buttons: Tab reaches it, the arrow keys move between choices and Space or Enter picks one. A choice can't be switched off, because the list is always sorted by something.
The group takes a value list and a change handler that receives the new list.
Related
- Pro
Weighted Category Ratings Reviews
Criteria and compareFive criteria as ruled rows with a bar, a score and a signed change against the previous quarter, and a Select that weighs them for everyday, commuting or gym use and re-derives the overall score.
- Pro
Accordion Detailed Breakdown Reviews
Criteria and compareFour areas of an e-bike as accordion rows from rail to rail, each with a bar, a score and a signed change against the previous quarter, opening into three scored parts, under a sentence that names the strongest and the weakest.
- Pro
Radar Criteria Spider Reviews
Criteria and compareA hand-built radar of six criteria with a toggle that lays one reviewer group, commuters or racers, over everyone, a description list of the scores and an unseen table for screen readers.
- Pro
Two Product Comparison Panel Reviews
Criteria and compareTwo blenders chosen with two Selects and set side by side: scores, review counts, five criterion rows with the higher score marked by bold, a check and the word Higher, and one pro, one con and one quote each.
- Pro
Compact List Reviews
Lists and pagesTwelve one-line reviews of a notes app as a real table with sortable column heads, a Select that mirrors the sort, and nothing to open.
- Pro
Rating Breakdown Reviews
Score summariesA review summary for a carry-on suitcase whose star rows filter the reviews: the average, the count, the share that would recommend it and a five-row distribution, beside the four most helpful reviews with a Helpful vote each.