{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "kpi-04",
  "description": "A value with its change and a button beside it that shows the date range, filters and query behind the number.",
  "registryDependencies": [
    "card",
    "https://www.dashboardblocks.com/r/radix/format.json",
    "https://www.dashboardblocks.com/r/radix/kpi.json",
    "https://www.dashboardblocks.com/r/radix/kpi-provenance.json"
  ],
  "files": [
    {
      "path": "registry/components/dashboardblocks/kpi/kpi-04.tsx",
      "content": "'use client'\n\nimport {\n  BlockStateProvider,\n  type BlockStateProps,\n  getBlockState,\n} from '@/registry/components/dashboardblocks/block-state'\nimport {\n  KPI,\n  KPIChange,\n  type KPIFormat,\n  KPITitle,\n  KPIValue,\n} from '@/registry/components/dashboardblocks/kpi'\nimport {\n  KPIProvenance,\n  type Provenance,\n} from '@/registry/components/dashboardblocks/kpi-provenance'\nimport { joinDetails } from '@/registry/lib/dashboardblocks/format'\n\nimport { Card, CardContent } from '@/components/ui/card'\n\ninterface KPI4Props extends BlockStateProps {\n  comparison: string\n  format?: KPIFormat\n  previous?: number\n  provenance: Provenance\n  title: string\n  /** Leave out to show the empty state. */\n  value?: number\n}\n\nconst exampleProps: KPI4Props = {\n  comparison: 'in August',\n  format: 'currency',\n  previous: 45_100,\n  provenance: {\n    query: 'billing.monthly_recurring_revenue',\n    description:\n      'Recurring revenue from active subscriptions, normalised to a month, before refunds',\n    window: { from: new Date(2026, 8, 1), to: new Date(2026, 8, 30) },\n    filters: { Plan: 'Pro', Region: 'Europe' },\n    href: '/dashboard/billing/subscriptions?plan=pro&region=europe',\n  },\n  title: 'Monthly recurring revenue',\n  value: 48_200,\n}\n\nconst KPI4 = (props: KPI4Props) => {\n  const { comparison, format, previous, provenance, errorMessage, status, title, value } =\n    props\n  const filters = Object.values(provenance.filters)\n\n  return (\n    <BlockStateProvider errorMessage={errorMessage} state={getBlockState(status, value)}>\n      <Card>\n        <CardContent>\n          <KPI className='gap-1'>\n            <KPITitle>{title}</KPITitle>\n            <div className='flex min-w-0 items-center gap-1'>\n              <KPIValue className='truncate' value={value} format={format} animated />\n              <KPIProvenance\n                label={`How is ${title.toLowerCase()} computed?`}\n                provenance={provenance}\n              />\n            </div>\n            <KPIChange comparison={comparison} previous={previous} value={value} />\n            {filters.length > 0 && (\n              <p className='text-muted-foreground text-sm'>{joinDetails(...filters)}</p>\n            )}\n          </KPI>\n        </CardContent>\n      </Card>\n    </BlockStateProvider>\n  )\n}\n\nexport { KPI4, exampleProps as kpi4ExampleProps, type KPI4Props }\n",
      "type": "registry:component",
      "target": "@components/dashboardblocks/kpi/kpi-04.tsx"
    }
  ],
  "meta": {
    "shows": "A value with its change and a button beside it that shows the date range, filters and query behind the number.",
    "size": "compact",
    "usedWith": [
      "kpi-01",
      "stat-group-02",
      "chart-panel-01"
    ],
    "component": "KPI4",
    "props": "{ comparison: string; format?: \"number\" | \"compact\" | \"currency\" | \"currency-compact\" | \"percent\"; previous?: number; provenance: { query: string; description: string; window: null | { from: Date; to: Date }; filters: Record<string, string>; href: string }; title: string; value?: number; errorMessage?: string; status?: \"loading\" | \"error\" }"
  },
  "type": "registry:component"
}
