{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "kpi-cards",
  "title": "KPI cards",
  "description": "Four metric cards with trend badges and comparison to last period.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "card"
  ],
  "files": [
    {
      "path": "registry/blocks/dashboard/kpi-cards.tsx",
      "content": "\"use client\"\n\nimport { ArrowDownRight, ArrowUpRight, CalendarCheck, DollarSign, Repeat, Users } from \"lucide-react\"\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\"\nimport { cn } from \"@/lib/utils\"\n\nconst KPIS = [\n  { label: \"Revenue\", value: \"$48,295\", change: 12.4, hint: \"vs. last month\", icon: DollarSign, spark: [12, 18, 14, 22, 19, 27, 31, 29, 36, 41] },\n  { label: \"Bookings\", value: \"1,284\", change: 8.1, hint: \"vs. last month\", icon: CalendarCheck, spark: [30, 28, 35, 33, 40, 38, 44, 47, 45, 52] },\n  { label: \"New clients\", value: \"312\", change: -3.2, hint: \"vs. last month\", icon: Users, spark: [22, 25, 24, 28, 26, 23, 24, 21, 22, 20] },\n  { label: \"Rebooking rate\", value: \"68.4%\", change: 4.7, hint: \"within 60 days\", icon: Repeat, spark: [55, 57, 56, 60, 61, 63, 62, 65, 66, 68] },\n]\n\nfunction Sparkline({ data, up }: { data: number[]; up: boolean }) {\n  const max = Math.max(...data)\n  const min = Math.min(...data)\n  const pts = data.map((v, i) => `${(i / (data.length - 1)) * 100},${30 - ((v - min) / (max - min || 1)) * 26 - 2}`).join(\" \")\n  const color = up ? \"var(--color-emerald-500, #10b981)\" : \"var(--color-rose-500, #f43f5e)\"\n  return (\n    <svg viewBox=\"0 0 100 30\" preserveAspectRatio=\"none\" className=\"h-10 w-full\" aria-hidden=\"true\">\n      <defs>\n        <linearGradient id={`fill-${up}`} x1=\"0\" x2=\"0\" y1=\"0\" y2=\"1\">\n          <stop offset=\"0%\" stopColor={color} stopOpacity=\"0.25\" />\n          <stop offset=\"100%\" stopColor={color} stopOpacity=\"0\" />\n        </linearGradient>\n      </defs>\n      <polygon points={`0,30 ${pts} 100,30`} fill={`url(#fill-${up})`} />\n      <polyline points={pts} fill=\"none\" stroke={color} strokeWidth=\"1.5\" vectorEffect=\"non-scaling-stroke\" strokeLinejoin=\"round\" />\n    </svg>\n  )\n}\n\nexport default function KpiCards() {\n  return (\n    <div className=\"grid gap-4 p-4 sm:grid-cols-2 md:p-6 xl:grid-cols-4\">\n      {KPIS.map((k) => {\n        const up = k.change >= 0\n        return (\n          <Card key={k.label} className=\"gap-3\">\n            <CardHeader className=\"flex flex-row items-center justify-between\">\n              <CardTitle className=\"text-sm font-medium text-muted-foreground\">{k.label}</CardTitle>\n              <span className=\"flex size-8 items-center justify-center rounded-md bg-muted\">\n                <k.icon className=\"size-4 text-muted-foreground\" />\n              </span>\n            </CardHeader>\n            <CardContent className=\"flex flex-col gap-2\">\n              <div className=\"text-2xl font-semibold tracking-tight tabular-nums\">{k.value}</div>\n              <div className=\"flex items-center gap-1.5 text-xs\">\n                <span className={cn(\"inline-flex items-center gap-0.5 rounded-md px-1.5 py-0.5 font-medium\", up ? \"bg-emerald-500/10 text-emerald-700 dark:text-emerald-400\" : \"bg-rose-500/10 text-rose-700 dark:text-rose-400\")}>\n                  {up ? <ArrowUpRight className=\"size-3\" /> : <ArrowDownRight className=\"size-3\" />}\n                  {Math.abs(k.change)}%\n                </span>\n                <span className=\"text-muted-foreground\">{k.hint}</span>\n              </div>\n              <Sparkline data={k.spark} up={up} />\n            </CardContent>\n          </Card>\n        )\n      })}\n    </div>\n  )\n}\n",
      "type": "registry:component",
      "target": "components/goodui/kpi-cards.tsx"
    }
  ],
  "categories": [
    "dashboard"
  ],
  "type": "registry:block"
}