RankMedal
The v3 mock's .rank: a 28px round number; 1–3 are gold, silver and bronze. Read as "Rank 1". size="lg" is the PR mock's leaderboard .rank: 30px, 13px figures, a 10px-radius square on the card colour.
import { RankMedal } from '@ergasti/bricks';Examples
Ranks
Gold, silver and bronze for the top three; any other rank is a plain number.
Code
import { RankMedal } from '@ergasti/bricks';
function Ranks() {
return (
<div style={{ display: 'flex', gap: 10 }}>
{[1, 2, 3, 4, 12].map((rank) => <RankMedal key={rank} rank={rank} />)}
</div>
);
}Sizes
md (default) is the brand mock's 28px round medal; size="lg" is the PR leaderboard's 30px rounded square with 13px figures. The top three keep their medal colours at either size.
Code (not run)
import { RankMedal } from '@ergasti/bricks';
function Sizes() {
return (
<div style={{ display: 'grid', gap: 12 }}>
<div style={{ display: 'flex', gap: 10 }}>{[1, 2, 3, 4].map((rank) => <RankMedal key={rank} rank={rank} />)}</div>
<div style={{ display: 'flex', gap: 10, padding: 8, borderRadius: 12, background: 'var(--soft)' }}>{[1, 2, 3, 4].map((rank) => <RankMedal key={rank} rank={rank} size="lg" />)}</div>
</div>
);
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key rankMedal, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
rank | Rank {n} | المركز {n} |
Design guidance
How the BRICKS design system uses RankMedal. Written in docs/content/components/RankMedal.md; the props above are read from the code, which wins where the two disagree.
A small rank number in a circle, gold, silver and bronze for 1–3; use it as the first cell of a ranked row.
RankMedal is the v3 mock's .rank: a 28px round badge with a 12px 800 number on --soft, coloured with the medal tokens for ranks 1, 2 and 3. size="lg" is the PR mock's leaderboard rank: a 30px rounded square (10px radius) on the card colour with a 13px number; medals still win there. It is read as "Rank 1", not as a bare number.
Anatomy
- Badge (
span.kit-rank,.kit-rank--lg,.kit-rank--1|2|3). - Number (
aria-hidden,dir="ltr"). - Spoken text (
.kit-sr): "Rank 1" / "المركز 1".
Variants
| Prop | Value | Look | When |
|---|---|---|---|
size | 'md' (default) | 28px circle | Brand tables and RankList |
size | 'lg' | 30px rounded square on --card | PR Portal leaderboards |
rank | 1 / 2 / 3 | --medal-1/2/3-bg and -ink | Podium |
rank | 4+ | --soft / --ink-2 | Everyone else |
States
Static; no interaction.
Usage
The Best creators table on Analytics:
const columns: DataColumn<Ranked>[] = [
{ key: 'rank', label: '#', render: (c) => <RankMedal rank={c.rank} /> },
{ key: 'creator', label: 'Creator', primary: true, render: (c) => <CreatorCell id={c.id} name={c.name} identity={c.identity} /> },
{ key: 'sales', label: 'Sales', align: 'end', render: (c) => <Money value={c.sales} compact /> },
{ key: 'share', label: 'vs #1', render: (c) => <ShareBar value={c.salesN} max={topSales} /> },
];PR leaderboard rank:
<RankMedal rank={4} size="lg" />Where it appears
- Brand › Analytics › Best creators table (rank column).
- Brand › Home › Top creators this month (via
RankList). - PR Portal › Affiliate programs › Challenges › challenge detail › "Leaderboard" (
size="lg"). - Screens: Analytics, Home, PR · Affiliate programs.
Guidelines
Do
- Pass the server's rank (ties may repeat a number).
- Keep it in the first column.
Don't
- Don't use medals for anything but ranks 1–3 of a real ranking.
RTL and Arabic
- Digits stay LTR; the badge sits at the inline start of the row.
Tokens
--soft, --ink-2, --card, --medal-1-bg, --medal-1-ink, --medal-2-bg, --medal-2-ink, --medal-3-bg, --medal-3-ink.
Accessibility
- Spoken as "Rank 1"; the visual number is hidden to avoid "1 Rank 1".
Found in the source
- ARIA attributes set:
aria-hidden. - Its tests cover: “is not focusable”.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
RankList: ranked rows with medals, people and bars.Leaderboard: the PR challenge leaderboard.ShareBar: the "vs #1" column beside it.
See also: Avatar · AvatarStack · Button · ButtonLink
Source
src/kit/primitives/RankMedal.tsx (line 11) on GitHub.