AI radar compare
Shown as Bearing, a made-up product
Where to open an engineering hub, as a radar of six criteria. Switch cities, weight what matters, and an analyst rewrites the verdict, names what decides it and suggests what to drop.
Installation
pnpm dlx shadcn@latest add "https://propui.dev/r/bearing-radar.json?token=…"Adds the piece to components/propui/05-bearing-radar/ and installs motion. Needs a free account: sign in and the command includes your token. Fonts load from Prop UI; download the zip to self-host them.
When to use
Reach for it when
- Comparing a few options across several criteria at once, such as cities, vendors or plans, on one radar.
- A decision where people weigh the criteria themselves and want to see the ranking and the verdict move as they do.
- Pairing a chart with an analyst that explains what decides the result and suggests what to drop.
Something else fits when
- One measure over time: a line or bar chart reads faster.
- More than three options on screen at once: a table with a weighted score column stays readable.
- Live operational numbers: Latency monitor is built for a stream.
Usage
Fills a full window: give it a container with a definite height.
import Piece from "@/components/propui/05-bearing-radar/Section";
export default function Page() {
return (
<main className="h-dvh w-full overflow-hidden">
<Piece />
</main>
);
}Replace AXES, CITIES, BASE, SHORTLIST, EXTRA, META and ASSUMPTIONS in data.ts. The weighted scores, ranking, verdict, deciding chips and the hide suggestion are all computed from the scores and the weights a person sets.
Your data
Replace these and everything on screen follows.
AXES{ id; short; full; note }[]- The criteria: the radar's spokes and labels, the weight sliders and the analyst's wording.
CITIESRecord<CityId, { id; name; country; scores }>- Every option and its score out of 100 per criterion (higher is better).
BASECityId- The option every other one is measured against.
SHORTLIST, EXTRACityId[]- The options on the compare switcher, and the ones Add a city can overlay.
WEIGHT_STEPSnumber[]- The stops on each weight slider (0 leaves a criterion out of the score).
META, ASSUMPTIONS{ company; owner; sources; updated }, string[]- The heading, the analyst's byline and the Assumptions list.
weighted()(city, weights, visible) => number- The weighted mean behind every score, rank and verdict.
Interactions
- Switch which city the base is compared with; the radar shapes morph and the verdict rewrites itself.
- Add a third city as a dashed overlay, and remove it with its ×.
- Hover or focus a criterion label (or hover near its point) to read every city's score on it.
- Press a deciding chip to highlight that criterion on the chart.
- Move a weight slider to change how much a criterion counts; Reset puts every weight back to 1×.
- Hide a criterion the analyst finds can't separate the cities, and Show all to bring it back.
- Export the scores and weights as CSV, copy a link to this view, or open the assumptions.
Keyboard
- ←or→or↑or↓
- On a criterion label, move to the next or previous criterion and read it.
- Esc
- Clear the reading on a criterion label, or close the Add a city menu.
- ←or→
- On a weight slider, step the weight down or up.
Behaviour
Read from the code: roles, motion, breakpoints and what runs.
Accessibility
- The radar is drawn for sight only; a visually hidden table gives every score and weight to screen readers.
- Each criterion label is a button whose name carries every city's score on it.
- The compare switcher is a radio group, the deciding chips are toggle buttons, and Weights and Assumptions report aria-expanded.
- Weight sliders have labels and read as '1.5 times'; the verdict is a polite live region and the toast is a status.
- The legend names each city beside its line, and the added city is dashed, so colour is never the only cue.
Motion
- Shapes morph point by point on one spring when the comparison, weights or hidden criteria change; a hidden criterion folds its spoke away.
- Scores roll to their new value, the ranking reorders with a layout spring, and the bars grow to their score.
- The verdict crossfades to its new sentence.
- Reduced motion jumps the shapes and figures straight to their new values.
Responsive
- The card is 1120px wide and shrinks with the screen; the radar keeps a square box up to 560px.
- Below 960px the analyst moves under the chart.
- Below 600px the header stacks, the switcher fills the width, the radar shrinks to 236px, and Weights folds behind a toggle.
Performance
- One animation frame loop runs only while the shapes are moving, and stops when they settle.
- The readout measures the chart box with a ResizeObserver, so it stays inside the chart at any width.
- No canvas or images: one local font file and inline SVG.
Notes for AI
Give your coding assistant the Markdown, not a screenshot.
- Keep every score in data.ts; never hard-code a total, rank or verdict.
- Scores are 0 to 100 with higher always better; invert a cost before it goes in.
- Light and dark follow the nearest data-theme attribute above the piece, or the system setting. Keep colours in the tokens at the top of post.css.
/p/bearing-radar/markdownThe whole library for assistants: llms.txt, or the MCP server in AI tools and MCP.