Leaderboard

Ranked bars. Rows are sorted by value, so when values change they slide into their new rank, bars regrow and numbers count. Data.

Open playground
  1. 1Iris Vale0 pts
  2. 2Teo Marsh0 pts
  3. 3Noor Haddad0 pts
  4. 4Cal Rivers0 pts
  5. 5Ada Quill0 pts

About

Leaderboard is a React component in the Data category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { Leaderboard } from "@ashutoshswamy/smoui" and set rows, limit, suffix.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { Leaderboard } from "@ashutoshswamy/smoui";

<Leaderboard
  rows={[{ id: "a", label: "Iris Vale", value: 482 }, { id: "b", label: "Teo Marsh", value: 431 }]}
  suffix=" pts"
  limit={5}
/>

Props 3

rows

Any order; they are ranked by value.

{ id: string; label: string; value: number; avatar?: string }[]
limit

Show only the top rows.

number
suffix

Appended to each number.

string