shadcn.io is not affiliated with official shadcn/ui
Radar Criteria Spider Reviews Block for Radix UI
A 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.
Installation
Overview
A criteria spider for React with Radix UI, for the Rafterford, a fictional road bike. A split behind a divider: at the end, a header, a three-way toggle (Commuters, Racers, Everyone) and a description list of the six criteria with the chosen group's score, everyone's and the signed gap; at the start, a framed square radar with six axes, grid rings at every point from 1 to 5, the chosen group as a solid filled outline and all eighteen reviewers as a dashed one. Choosing Everyone draws only the solid outline. The criteria and scores are HTML round the chart, an unseen table carries the same numbers for a screen reader, and every score is worked out from the eighteen typed reviews at the top of the file. On a phone the order is the header, the toggle, the chart, then the list. It's built from Toggle Group, Guides and hand-drawn SVG.
FAQ
Where do the numbers come from?
From the REVIEWS array: each review has a reviewer group and six scores from 1 to 5 in the order of CRITERIA. A group's score for a criterion is the average of its reviews, to one decimal; Everyone averages all eighteen, including the four weekend riders who are not in the toggle. The outlines, the labels, the list and the table are all computed from those scores, so they always agree.
How is the radar drawn?
Six axes from the middle of a 100 by 100 box, each ring a polygon at one point of the score, the outlines polygons whose vertex on an axis sits at its score over five. The strokes keep a constant width however the chart scales, and the polygons grow from the middle once on load unless reduced motion is on. The names and scores are HTML placed by CSS variables, so the text stays crisp.
How does the toggle work?
It is a single-choice group of buttons: Tab reaches it, the arrow keys move between groups and Space or Enter picks one. One group is always chosen. Its choice redraws the solid outline and rewrites the labels and the list.
The group takes a value list or string and a change handler that reads the new value.
How does a screen reader get the chart?
The drawing is hidden from assistive technology; the description list beside it says the chosen group's score for each criterion against everyone's with the gap, and an unseen table lists all three groups' scores for every criterion. Nothing is shown by colour: the groups differ by a solid and a dashed outline.
Related
- Weighted Category Ratings ReviewsCriteria and compare
- Criterion Picker Multi-Criteria ReviewsCriteria and compare
- Accordion Detailed Breakdown ReviewsCriteria and compare
- Generation Benchmark Compare ReviewsCriteria and compare
- Two Product Comparison Panel ReviewsCriteria and compare
- Rating Breakdown ReviewsScore summaries