Leaderboard
ProNewA ranking with its evidence: score bars that fill from the top place down, confidence intervals as whiskers, and how many places each entry moved.
Installation
pnpm dlx shadcn@latest add @viewport/leaderboard
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| title* | string | — |
| metric* | stringWhat the score is, e.g. "Accuracy (%)". | — |
| entries* | LeaderboardEntry[] | — |
| max | numberThe top of the score scale. Defaults to the highest score with its margin. | — |
| format | (score: number) => string | (score) => score.toFixed(1) |
| accent | stringThe bar color of the featured entry. | "oklch(0.7 0.12 235)" |
| className | string | — |
Accessibility
- An ordered list, sorted by score in the component so order and data cannot disagree.
- Movement is an arrow, a number and a word for screen readers.
- The margin is written beside the score as well as drawn.
- Bars are shown filled under reduced motion.