Fair Rank

Fair Rank is a copy-paste React component that stops tied players shown with different ranks before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/fair-rank
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsTied players shown with different ranks

Was this component page useful?

How do I install Fair Rank?

pnpm dlx shadcn@latest add @bollard/fair-rank

The files land in your project. They're yours to edit.

How do I use Fair Rank in React?

fair-rank-usage.tsx
import { FairRank, type RankEntry } from "@/components/ui/fair-rank"

<FairRank caption={`Support CSAT, ${week}`} entries={WEEKS[week]} minSamples={20} samplesLabel="ratings" format={(s) => `${s}%`} />

What input mistakes does Fair Rank catch?

  • Equal-looking scores given different ranks
  • Movement since the last period
  • Entries with too few samples, set aside with the reason

What props does Fair Rank accept?

FairRank props
PropTypeDefault
higherIsBetter

Set false for times, golf scores and anything where lower wins.

booleantrue
minSamples

Entries with fewer samples are listed but not ranked, and don't push anyone down.

number0
decimals

Decimals shown. Scores are compared as displayed, so two scores that look equal always share a rank.

number1
entries* (required)

Rows to rank, with scores and optional previous rank.

RankEntry[]—
caption

Table caption, e.g. "CSAT, October".

string—
format

Formats a score for display; receives the score already rounded to `decimals`.

(score: string) => string(s) => s
samplesLabel

Noun for samples, e.g. "ratings".

string"samples"
unrankedText

Templates: `{min}`, `{has}`, `{samples}`, `{rank}`.

string"Not ranked: needs {min} {samples}, has {has}. Would be {…
tieNote

Note explaining how ties are ranked.

string"T = tied. Tied entries share a rank, so the next rank is…
newLabel

Label for entries new this period.

string"New"
formatOrdinal

Turns a rank into words for screen readers and the unranked note: 3 → "3rd".

(rank: number) => stringenglishOrdinal
tiedPrefix

Shown before a tied rank: "T-" gives T-2.

string"T-"
tiedText

Screen reader text for a tied rank. `{rank}` is the ordinal.

string"Tied {rank}"
noChangeLabel

Screen reader text for movement.

string"No change"
upLabel

Text for moving up.

string"Up"
downLabel

Text for moving down.

string"Down"
columnLabels

Hidden column headers, read by screen readers.

{ rank?: string; name?: string; score?: string; change?: string }—
unrankedLabel

Name of the list of entries that aren't ranked yet.

string"Not ranked yet"

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is Fair Rank accessible?

  • A real table with a header row
  • Ties and movement are stated in text ("tied", up/down labels), not only colour or arrows
  • Row animations are skipped with prefers-reduced-motion

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Ties are judged at the displayed precision; finer differences are ignored on purpose
  • Uses standard competition ranking only

What expensive mistakes does Fair Rank stop?

Tied players shown with different ranks

Also known as

leaderboard · ranking · ties · scores · hackathon results · gamification · standings · top players

Field type

What dependencies does Fair Rank require?

Fair Rank facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameFair Rank
Registry identifier@bollard/fair-rank
Install commandnpx shadcn@latest add @bollard/fair-rank
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Fair Rank

What form validation mistake does Fair Rank catch?

Fair Rank prevents tied players shown with different ranks. Ranks ties fairly at the precision shown and sets aside entries with too few samples, so leaderboards don't mislead. Catches: Equal-looking scores given different ranks, Movement since the last period, Entries with too few samples, set aside with the reason. Limitation: validate fair-rank schemas on backend.

How do I install fair-rank with shadcn?

Run `npx shadcn@latest add @bollard/fair-rank`. Sources added: registry/default/fair-rank/fair-rank.tsx. Package requirements: lucide-react.

What props customize Fair Rank?

Fair Rank accepts `higherIsBetter`, `minSamples`, `decimals`, `entries`, `caption`. Configures leaderboard, ranking, ties behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of fair-rank?

Ties are judged at the displayed precision; finer differences are ignored on purpose. Uses standard competition ranking only Server requirement: backend verification for fair-rank.

How does Fair Rank meet accessibility guidelines?

A real table with a header row. Ties and movement are stated in text ("tied", up/down labels), not only colour or arrows. Row animations are skipped with prefers-reduced-motion. Minimizes errors: leaderboard tie ranking, same score different rank.

Which components pair with Fair Rank?