StatGrid
SM · 950B gzip budgetGrid layout for displaying multiple KPI metrics.
- Category
- Data display
- Budget
- sm, single-purpose control
- External runtime
- React / React DOM only
axe fixtureSSR rendersource scanbundle budget
Preview
Live fixtureRevenue
$12k
Users
1.2k
Try the component here. Locale-aware formatting and direction follow the selected language; example content and labels are not automatically translated. Overlay demos use interactive launchers.
Install
npx shadcn@latest add https://gear5-ui.vercel.app/r/stat-grid.jsonCopies the source into your project.
New here? Set up Tailwind and import aliases first →Source & props
Edit on GitHub ↗Prop types and inline documentation are included below. This is repository source; the installer rewrites shared imports for your project.
"use client";
import React from "react";
export interface StatItem {
label: string;
value: string | number;
description?: string;
}
export interface StatGridProps {
stats: StatItem[];
columns?: 2 | 3 | 4;
className?: string;
ariaLabel?: string;
renderItem?: (stat: StatItem, index: number) => React.ReactNode;
}
export function StatGrid({
stats,
columns = 2,
className = "",
ariaLabel,
renderItem,
}: StatGridProps) {
return (
<div
role="list"
aria-label={ariaLabel}
className={className}
style={{
display: "grid",
gridTemplateColumns: `repeat(${columns}, 1fr)`,
gap: "1rem",
}}
>
{stats.map((stat, index) => (
<div
key={index}
role="listitem"
style={{
padding: "1rem",
border: "1px solid var(--color-border, #e5e7eb)",
borderRadius: "0.5rem",
background: "var(--color-bg, #fff)",
}}
>
{renderItem ? (
renderItem(stat, index)
) : (
<>
<div
style={{
fontSize: "0.75rem",
textTransform: "uppercase",
letterSpacing: "0.05em",
color: "var(--color-muted, #6b7280)",
marginBlockEnd: "0.25rem",
}}
>
{stat.label}
</div>
<div
style={{
fontSize: "1.5rem",
fontWeight: 700,
color: "var(--color-text, #111827)",
}}
>
{stat.value}
</div>
{stat.description && (
<div
style={{
fontSize: "0.875rem",
color: "var(--color-muted, #6b7280)",
marginBlockStart: "0.25rem",
}}
>
{stat.description}
</div>
)}
</>
)}
</div>
))}
</div>
);
}
What CI checks
Quality contract- Bundled, minified and gzipped against its tier budget
- Audited by axe in the state previewed above
- Rendered through react-dom/server with no browser globals
- Scanned for network calls, dangerous sinks, and unguarded animation