Stats band
A full-width band of three or four big numbers between hairlines.
npx shadcn@latest add https://ui.goodtabs.co/r/stats-band.json
With the @goodtabs namespace in components.json: npx shadcn@latest add @goodtabs/stats-band
- components
- 200
- installs
- 12k
- median size
- <5 kB
Components, installs and size.
Four numbers
- components
- 200
- categories
- 10
- accessibility score
- 100
- licence
- MIT
Four columns from md up, two by two on phones.
Usage
import { StatsBand } from "@/components/stats-band"
<StatsBand stats={[{ value: "200", label: "components" }, { value: "MIT", label: "licence" }, { value: "10", label: "categories" }]} />Props
| Prop | Type | Default | Description |
|---|---|---|---|
| stats | { value: string; label: string }[] | Three or four numbers. Keep values short. |
Source
stats-band/stats-band.tsx
import * as React from "react";
import { cn } from "@/lib/utils";
export type BandStat = { value: string; label: string };
type StatsBandProps = React.ComponentProps<"section"> & {
/** Three or four numbers. Keep the values short. */
stats: BandStat[];
};
/**
* A full-width band of big numbers between hairlines, with dividers between them.
* Server component. The numbers sit in a description list, so a screen reader hears value and label together.
*/
export function StatsBand({ stats, className, ...props }: StatsBandProps) {
return (
<section data-slot="stats-band" className={cn("w-full border-y bg-background", className)} {...props}>
<dl
className={cn(
"m-0 mx-auto grid max-w-6xl gap-px bg-border",
stats.length >= 4 ? "grid-cols-2 md:grid-cols-4" : "sm:grid-cols-3",
)}
>
{stats.map((s) => (
<div key={s.label} className="flex flex-col-reverse gap-1 bg-background px-6 py-8 text-center">
<dt className="text-xs text-muted-foreground">{s.label}</dt>
<dd className="m-0 text-3xl font-medium tracking-tight tabular-nums sm:text-4xl">{s.value}</dd>
</div>
))}
</dl>
</section>
);
}
For AI agents
Hand your agent this page, the markdown at /components/stats-band/prompt.md, or the Copy AI prompt button above.
When to use
- Between a hero and the feature sections
- Full-width proof with real numbers
- Landing pages that need a pause in rhythm
When not to use
- Dashboards, where stat-card carries trends
- More than four numbers
- Numbers you cannot back up
Agent notes
- Server component; the band is a section with border-y and a dl inside
- Dividers are 1px gaps over bg-border, so they stay hairline at any width
- Two columns on phones, three or four from md depending on the count
- Place it directly in main, outside any max-width container
The maths
- Dividers are gap-px over bg-border: a 1px gap fills with the hairline colour, so n columns draw n - 1 rules with no borders to collapse.
- Columns: 4 stats give grid-cols-4 from md, 3 give grid-cols-3, each 100% / n wide.