{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "stat-group-04",
  "description": "Five metrics in a slim row with their changes, wrapping to two columns when narrow.",
  "registryDependencies": [
    "card",
    "https://www.dashboardblocks.com/r/radix/stat-group.json"
  ],
  "files": [
    {
      "path": "registry/components/dashboardblocks/stat-group/stat-group-04.tsx",
      "content": "'use client'\n\nimport {\n  BlockStateProvider,\n  type BlockStateProps,\n  getBlockState,\n} from '@/registry/components/dashboardblocks/block-state'\nimport {\n  Stat,\n  StatChange,\n  StatGroup,\n  StatLabel,\n  type StatMetric,\n  StatValue,\n  formatStatValue,\n  getStatPlaceholders,\n} from '@/registry/components/dashboardblocks/stat-group'\nimport { formatCurrency, formatPercent } from '@/registry/lib/dashboardblocks/format'\n\nimport { Card, CardContent } from '@/components/ui/card'\n\ninterface StatGroup4Props extends BlockStateProps {\n  /** Leave out, or pass none, to show the empty state. */\n  metrics?: StatMetric[]\n  /** How many metrics to sketch while loading. @default 5 */\n  placeholders?: number\n}\n\nconst exampleProps: StatGroup4Props = {\n  metrics: [\n    {\n      formatter: (value) => formatCurrency(value, { compact: true }),\n      key: 'mrr',\n      label: 'MRR',\n      previous: 80_800,\n      value: 84_200,\n    },\n    { key: 'customers', label: 'Customers', previous: 1_186, value: 1_241 },\n    {\n      formatter: (value) => formatCurrency(value, { precision: 'exact' }),\n      key: 'arpu',\n      label: 'ARPU',\n      previous: 68.13,\n      value: 67.85,\n    },\n    {\n      changeType: 'points',\n      formatter: (value) => formatPercent(value / 100),\n      goodDirection: 'down',\n      key: 'churn',\n      label: 'Churn',\n      previous: 2.4,\n      value: 2.1,\n    },\n    {\n      changeType: 'points',\n      key: 'nps',\n      label: 'NPS',\n      previous: 44,\n      value: 48,\n    },\n  ],\n}\n\nconst StatGroup4 = (props: StatGroup4Props) => {\n  const { metrics = [], placeholders = 5, errorMessage, status } = props\n  const shown = status === 'loading' ? getStatPlaceholders(placeholders) : metrics\n\n  return (\n    <BlockStateProvider\n      errorMessage={errorMessage}\n      state={getBlockState(status, metrics)}\n    >\n      <Card>\n        <CardContent>\n          <section className='@container flex flex-col gap-4'>\n            <StatGroup className='grid-cols-2 gap-x-4 gap-y-3 @2xl:auto-cols-fr @2xl:grid-flow-col @2xl:grid-cols-none'>\n              {shown.map((metric) => (\n                <Stat\n                  key={metric.key}\n                  className='flex-row flex-wrap items-baseline gap-x-2 gap-y-0.5 pt-2'\n                >\n                  <StatLabel className='basis-full truncate text-xs'>\n                    {metric.label}\n                  </StatLabel>\n                  <StatValue className='text-2xl'>{formatStatValue(metric)}</StatValue>\n                  <StatChange className='text-xs' metric={metric} variant='short' />\n                </Stat>\n              ))}\n            </StatGroup>\n          </section>\n        </CardContent>\n      </Card>\n    </BlockStateProvider>\n  )\n}\n\nexport { StatGroup4, exampleProps as statGroup4ExampleProps, type StatGroup4Props }\n",
      "type": "registry:component",
      "target": "@components/dashboardblocks/stat-group/stat-group-04.tsx"
    }
  ],
  "meta": {
    "shows": "Five metrics in a slim row with their changes, wrapping to two columns when narrow.",
    "size": "full",
    "usedWith": [
      "chart-panel-02",
      "kpi-02",
      "data-table-01"
    ],
    "component": "StatGroup4",
    "props": "{ metrics?: { changeType?: \"percent\" | \"points\" | \"count\"; detail?: ReactNode; formatter?: (value: number) => string; goodDirection?: \"up\" | \"down\"; key: string; label: string; previous?: number; tone?: \"warning\" | \"bad\"; value: number }[]; placeholders?: number; errorMessage?: string; status?: \"loading\" | \"error\" }"
  },
  "type": "registry:component"
}
