shadcn.io is not affiliated with official shadcn/ui
Compact List Leaderboard Stats Block for React
A league table for a pub-quiz league in a split: the header and three season facts at the start, and all twelve teams in dense rows, two columns of six, at the end.
Installation
Overview
A compact league table for React with Base UI. A split gives the start column to the header ("Table Nine lead the league by 4 points"), three facts about the season (week played, number of teams, teams level on points) and a note on how ties are settled. The end column, across a divider, holds all twelve teams as dense rows: a mono rank, the team's name, truncated when it is long, and its league points. From lg the rows run in two columns of six that read down the first column and then the second; below it they are one column. The order and the ranks come from typed results when the module loads, league points first and then the quiz points scored over the season, so the two teams level on 49 points are split the way the note says. For a leaderboard where density matters more than shape: top lists, ladders, a league in a side column.
FAQ
How do I change the teams and the points?
Edit the TEAMS array at the top of the file: a name, the league points and the quiz points scored (scored, which only breaks ties). The table sorts itself, ranks the rows from 01 and works out the headline margin and the count of teams level on points, so you never type a rank. Change PLAYED and SEASON for the week line.
Can I show ten rows or fourteen instead of twelve?
Yes. The list is a grid that fills columns first (lg:grid-flow-col lg:grid-cols-2 lg:grid-rows-6), so set grid-rows-N to half the number of rows, and update edgeOf, which gives the first row of each column its top hairline (row one, and the row at index N from lg). An odd count leaves the second column one row short, which is fine.
How are ties handled?
Teams level on league points are ordered by the quiz points they scored over the season, and the note under the facts says so. If both numbers are equal the sort keeps the order they have in TEAMS, so put the team you want first earlier in the array.
Is it accessible?
The table is an ordered list, so a screen reader announces the position of each row. The rank is also text in each row, and the points carry a visually hidden "points", so a row reads "01 Table Nine 61 points". Names are truncated by the layout only; the full text is in the page. The points are in bdi elements so right-to-left pages keep the number intact.
Related
- Pro
Ranked List Leaderboard Stats
LeaderboardsA six-row ranking in a hairline frame with a Week and Month switch that re-ranks the table: a large numeral and a quiet tint for the leader, and points that roll to their new numbers.
- Pro
Movement Leaderboard Stats
LeaderboardsA league table with rank movement for eight clubs: an arrow, a word and a number (Up 4) and the two places as microcopy (7 to 3), with the biggest climber and the biggest faller beside it.
- Pro
Score Bar Leaderboard Stats
LeaderboardsSeven quiz players in a band that runs from rail to rail, each row a name, a context line, the points and a thin bar measured against the leader's score.
- Pro
Horizontal Bar Chart Card Stats
Bar and columnNine ranked survey answers where each row is its own bar: a quiet fill from the start behind the label, the share and the count at the end, and the leading row a little stronger.
- Pro
Dense Checklist Progress Stats
Goals and progressA dense onboarding checklist for a customer-success tool, ten steps in a three-part row beside a summary of how far new accounts get.
- 213Pro
Leaderboard Podium Features
Metrics and chartsA leaderboard: a podium of the top three at different heights in foreground tones, set on the rule of a ranked table of eight with trend arrows, and a segmented control that ranks by adoption or by speed.