Staaarter

Ranked Leaderboard Stats

A ranked list of 5-6 rows, each showing a rank number, a name, and a metric value, with a subtle bar-width fill behind the row proportional to a supplied width percentage. Suited to "top regions", "top products", or any other ranked-comparison stat block.

By Staaarter Team
Stats
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/ranked-leaderboard-stats.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/stats/stats14.tsx instead.

Usage

The file also exports stats14Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.

import { Stats14, stats14Demo } from "@/components/blocks/stats/stats14";

export default function Page() {
  return <Stats14 {...stats14Demo} />;
}

Props

PropTypeDefaultDescription
eyebrowstringundefinedSmall label above the heading.
headingstringnoneSection heading.
descriptionstringundefinedOptional supporting sentence under the heading.
rowsLeaderboardRow[]noneRanked rows, rendered in the order supplied (index + 1 is the displayed rank).
classNamestringnoneExtra classes for the outer section element.

Types

type LeaderboardRow = {
  name: string;
  value: string;
  /** Bar width as a percentage of the row's track, 0-100. Author-supplied, not computed from value. */
  barWidth: number;
};

Behavior notes

  • Rank numbers are derived from array position (index + 1), not from a separate rank field, so the caller controls order by array order.
  • barWidth is a plain author-supplied percentage rendered as a div's inline width style; it is not computed from value, so the caller is responsible for keeping the two visually consistent.
  • Static and non-interactive: the bar fill renders at its final width immediately, there is no grow-in animation.