Data

Rank List

A ranking whose rows travel to their new place on springs when the numbers change.

Preview

Installation

Terminal
npx @usefluid/cli add rank-list

Usage

RankList.tsx
import { RankList } from "./RankList";

<RankList label="Sales this month" items={[{ id: "ana", label: "Ana", value: 610 }, { id: "bruno", label: "Bruno", value: 560 }]} />

API reference

PropTypeDefaultDescription
labelstring—The title of the ranking.
items{ id, label, value }[]—The rows. Ids must be stable: they tell which row moves where.
order"desc" | "asc""desc"Highest first, or lowest first for times and costs.
formatIntl.NumberFormatOptions—How values are written, as in Intl.NumberFormat.
localestringthe browser'sLocale for the values.

Keyboard and screen readers

An ordered list in the ranked order, so screen readers read the places right. The rolling numbers are hidden from them; they read the final value. With reduced motion rows jump to their place.

Notes

Ties keep the order they were given, so rows never swap back and forth. A row that climbs passes over the others. Every colour comes from the --fluid-* variables, and the piece is yours to change.

How it is made

Each row has a spring for its place, so when the order changes the rows slide past each other instead of jumping, and a row that climbs passes over the rest. The values roll on springs of their own. The list is in ranked order in the page, so screen readers read the places right, and ties keep their order.

For your agent

For your agent

Add Rank List to my project with the Fluid library. Use RankList for the leaderboards and top lists of my dashboard, with stable ids for each row. Read my project first. Use my logo, my colours and my font through the --fluid-* variables. Keep 44px touch targets, visible focus and reduced motion. If I have no SVG logo, ask before making one up.