shadcn.io is not affiliated with official shadcn/ui
Hero Metric Card Stats Block for React
One headline figure for a treasury tool, cash on hand in a big number inside a card in a card, with a change pill, a comparison and a two-line footnote that says when it was read and from where.
Installation
Overview
A hero metric card for React with Base UI. A centred header states what the number means ("Cash is up 6.2% and covers 15.6 months"), and under it a tinted shell with a + on each corner holds a raised panel. The panel has a label, the cash on hand as a big number that rolls up once the card scrolls into view ("$1,284,600"), a pill with the change on last month (filled for a rise, outlined for a fall, always with an arrow and a sign) and "vs last month", and under a hairline a two-line footnote: when the figure was read and where it came from. The change, the runway and the headline are computed from one typed balance, last month's balance and the monthly burn, so the text can't disagree. The card follows the theme: the shell is a tint, the panel a raised card, and nothing is a primary surface. It's built from Frame, Badge, SlidingNumber and Guides.
FAQ
How do I change the figure?
Edit CASH (the balance now, a month ago and the monthly burn) and NOTE (when and from where) at the top of the file. The big number, the percentage in the pill, the sign, the arrow, the runway in the header and the "up" or "down" in the header are all computed from CASH. A negative change draws an outlined pill with a down arrow and a true minus sign instead of the filled one.
How is the card in a card built?
The shell is a Frame with a hairline, a light tint and a small padding; the panel inside is a rounded bg-card with a ring and a shadow, so it reads as raised in light and dark themes alike. The + marks come from a Guides layer on the shell, whose lines run a little past its corners, so the shell sits inset from the rails. Nothing uses the primary colour.
Why is the pill filled for a rise?
Structure carries the emphasis, not colour: a rise is the filled foreground pill, a fall is an outline and no change is a muted pill. The arrow and the sign say the same in text, so the direction never depends on colour, and the pill is correct in every theme preset.
Is it accessible?
Yes. The big number is read as "1,284,600" (with the dollar sign), not as rolling digits; the change is read as "plus 6.2 percent" followed by "vs last month". The arrow is hidden from assistive technology. The footnote is a description list, so "As of" and "Source" are read with their values. The number sits in a bdi element so a right-to-left page doesn't move the dollar sign.
Related
- Pro
Minimal Hero Metric Stats
Hero metricOne number and nothing else for a food-bank tool: the week's meals served in display type under the page's top rule, one hairline and one sentence that compares it with last week and last year.
- Pro
Split Subvalues Hero Metric Stats
Hero metricA parcel carrier's weekly total in display type at the start of a split, with its three service levels as rows at the end, each with its count and a share bar, so the shares add up to exactly 100%.
- Pro
Metric Tile Row Stats
Hero metricAn asymmetric band of four figures for a property-management tool: one double-width hero cell for rent collected and three small cells for occupancy, arrears and renewals, each with its change on the month before.
- Pro
Delta Arrow Hero Metric Stats
Hero metricA hero figure for an ad-spend tool beside an oversized arrow whose angle is the slope of the change, with a pill for the percent and its comparison.
- Pro
Sparkline Hero Metric Stats
Hero metricA hero figure for a cash-planning tool beside its own 90-day trend: the runway in months at the start, and a wide line with its high, its low and today marked.
- Pro
Card Inset Big Metric Checklist CTA
Figures and statsA card-in-card startup-program CTA split in two: one giant credit figure circled by a hand-drawn pen stroke in a hairline frame at the start, and the headline, a three-line checklist, a Shine Button and an eligibility note at the end.