Stat strip
Big medium-weight numbers on a soft band, the first one leading.
- Active developers
- 450+
- Uptime
- 99.9%
- Screenshots a month
- 0.8M+
- Median render
- 1.2s
Install
$ npx shadcn@latest add @nudgekit/stat-stripOr with no config: npx shadcn@latest add https://ui.nudgekit.app/r/stat-strip.json
Usage
usage.tsx
import { StatStrip } from "@/components/stat-strip"
<StatStrip stats={[
{ value: "450+", label: "Active developers" },
{ value: "99.9%", label: "Uptime" },
]} />Do
- Lead with the most important number.
- Use real numbers only.
Don't
- Make the numbers bold.
Code
What the CLI writes into your project. It is yours to change.
components/stat-strip.tsx
import * as React from "react";
import { cn } from "@/lib/utils";
export interface StatStripProps {
stats: { value: string; label: string }[];
className?: string;
}
/** Big medium-weight numbers on a soft band. The first number leads in navy with a purple top line; the rest sit in grey. */
function StatStrip({ stats, className }: StatStripProps) {
return (
<section data-slot="stat-strip" className={cn("border-y border-border bg-surface", className)}>
<dl className="mx-auto grid max-w-[1120px] grid-cols-2 gap-6 px-6 py-14 md:grid-cols-4">
{stats.map((s, i) => (
<div key={s.label} className="relative border-t border-line-strong pt-4">
{i === 0 && (
<span
aria-hidden
className="absolute -top-px left-0 h-0.5 w-full"
style={{ background: "linear-gradient(90deg, transparent, var(--brand), transparent)" }}
/>
)}
<dt className="sr-only">{s.label}</dt>
<dd className={cn("text-[34px] font-medium tracking-[-0.03em]", i === 0 ? "text-foreground" : "text-faint")}>{s.value}</dd>
<dd className="mt-1.5 text-sm text-muted-foreground" aria-hidden>
{s.label}
</dd>
</div>
))}
</dl>
</section>
);
}
export { StatStrip };