StatTile

One topic, one big figure, one action.

$ npx shadcn@latest add https://mahrdesign.faizintifada.com/r/stat-tile.json

The action slot

The tile is fixed; only the last line changes: button · note · nav · empty. Nothing else exists. On one screen, at most one primary button (in a tile or anywhere else).

Sisa cuti tahunan

5

Hangus 31 Des
Bisa diajukan · 2 menunggu HR

Gajian berikutnya

24 Des

7 hari lagi
Kamis · masuk ke rekening Anda

Lebih awal 1 hari: 25 Des libur Natal.

Cuti penting

2hari tersisa dari 3

Untuk nikah, duka, atau acara keluarga.
Lihat cuti saya

Slip gaji

Belum ada slip

Slip pertama terbit Kamis, 24 Des.

States

The tile itself is not clickable; only its action reacts. Money is always exact; if it does not fit at 32, compact = 28 (the only allowed step). Never wrap, never truncate a number.

Sisa cuti tahunan

Gajian berikutnya

–

Gagal dimuat.

Slip gaji November

Rp 123.509.137

Dibayar 25 Nov

Motion

Motion: loading → data plays 14 skeleton reveal (the skeleton pulses, then both layers cross-fade with a 2px cross-blur, 400 ms). A changed figure plays 36 number subtle change: only the changed digits cross-fade, falling when the figure shrinks and rising when it grows. Press "Muat ulang", "Ajukan 2 hari" or "+1 hari". Reduced motion: instant swap.

Sisa cuti tahunan

5

Hangus 31 Des
Bisa diajukan

Slip gaji November

Rp 12.509.137

Dibayar Rabu, 25 Nov

When to use

  • The answer row on Beranda: Sisa cuti, Gajian berikutnya, Slip gaji.
  • Balance rows: Cuti tahunan · Cuti penting · Cuti sakit on Cuti saya.
  • Admin Ringkasan KPIs (figure + badge + one action link).

When not to use

  • More than one figure about the same topic → Card + ListRow (key-value).
  • A list of items → Card + ListRow.
  • A trend over time → a chart card in Laporan, never a sparkline in a tile.
  • More than 4 tiles in one row → cut the data; the 5th figure is not needed.

Do and don't

DoThe figure the user can act on"5" with "Bisa diajukan · 2 menunggu HR" under it: the big number already subtracts requests waiting for HR.
Don'tProgress bars, two figures, unequal heights"7 hari tersisa dari 12" plus a bar says the same thing twice. Tiles of different heights break the line of actions.

Installation

Add StatTile with the shadcn CLI (your project needs a components.json and the MaHR theme: https://mahrdesign.faizintifada.com/r/theme.json), or copy the files by hand.

terminal
bunx --bun shadcn@latest add https://mahrdesign.faizintifada.com/r/stat-tile.json

API

import { StatTile, StatTileRow } from "@/components/mahr/stat-tile"
PropTypeDefaultDescription
moduleModuleId–Colours the icon tile only.
icon · labelNeatIcon · string–Label one line, max 24 characters.
value · unitstring | null · string?–Pre-formatted ("5", "Rp 12.509.137"). null = empty → emptyText.
badgeReactNode–One Badge at the right of the figure (centred on it). Wraps under the figure only when both do not fit.
metaReactNode–One muted line under the figure: short text only.
action{ kind: "button", label, variant?, icon?, onClick? } | { kind: "nav", label, href?, render? } | { kind: "note", text }–Always the last line. Max one primary per screen.
compactbooleanfalse28 instead of 32 for long money.
loading · error · onRetryboolean · boolean · () => voidfalseSame height in every state: the skeleton and the error take the box of figure + nav row. Error shows "–" and one row: muted "Gagal dimuat." + a secondary sm "Coba lagi" (the shared failed-load pattern).
emptyTextstring"–"Shown when value is null. Say what comes and when ("Belum ada slip"), not "Belum ada data".
<StatTileRow>children: 2–4 StatTile–Equal widths, gap 16, equal heights.