shadcn.io is not affiliated with official shadcn/ui
Generation Benchmark Compare Reviews Block for React
A running watch scored against its own previous generation in a sortable table: Gen 1 and Gen 2 scores each over a thin bar, the signed change with an arrow, and header buttons that sort by criterion or by biggest change.
Installation
Overview
A benchmark compare table for React with Base UI, for the Hobnailfold Stride 2, a fictional running watch set against its own first generation. A start-aligned header carries a derived sentence naming the biggest gain and the biggest drop; under a rule with plus marks, a real table gives each criterion's Gen 1 score and Gen 2 score, each above a thin bar from the score out of five, the signed change with an arrow, and a closing row with the average of the six. The Criterion and Change headers are buttons that sort the rows (A to Z, or biggest change first) and set aria-sort, and a polite line says the order. Every score and change is worked out from the twenty-two typed reviews at the top of the file. It's built from a native table, the button styles and Guides.
FAQ
How are the scores and changes worked out?
Each review in REVIEWS has a generation and six scores from 1 to 5. A cell's score is the average of that generation's reviews for the criterion, to one decimal; the change is the Gen 2 score minus the Gen 1 score as shown, so the sign always matches the numbers in the row. The closing row averages the six shown scores. The two sentences in the header pick the largest rise and the largest fall from the same numbers.
How does the sorting work?
Press Criterion to sort A to Z and again for Z to A; press Change to sort by the biggest change first, either direction, and again for the smallest first. The header of the sorted column carries aria-sort and an arrow, the others say "none", and a polite line reads the new order. Ties fall back to the criterion's name. Sorting happens on the press, never under the pointer, and the table keeps its height.
Why a native table on every library?
A caption, column and row scopes and aria-sort are plain HTML, and a native table keeps them on all of the libraries and ports; the catalog tables of two of them are grids that do not carry a caption. The sort buttons use the catalog button's styles on a plain button.
How are the bars read, and without colour?
Both bars run from 0 to 5 over the same width: Gen 1 in a lighter weight of the foreground, Gen 2 in the full weight, and each sits under its own number. The change is an arrow, a sign and a word for a screen reader ("up 1.4", "down 1.1"), never green or red.
Related
- 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
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
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.
- 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
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
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.