{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chart-legend",
  "type": "registry:component",
  "title": "Chart legend",
  "description": "Series keys and formatted values for charts, quotas, and compact reports.",
  "categories": [
    "charts"
  ],
  "dependencies": [],
  "registryDependencies": [],
  "files": [
    {
      "path": "src/registry/overtrue/chart-legend.tsx",
      "type": "registry:component",
      "target": "components/overtrue/chart-legend.tsx",
      "content": "import type { ReactNode } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface ChartLegendItem {\n  label: string;\n  color: string;\n  value?: ReactNode;\n  dashed?: boolean;\n}\nexport function ChartLegend({\n  items,\n  label = \"Chart legend\",\n  layout = \"vertical\",\n  className,\n}: {\n  items: readonly ChartLegendItem[];\n  label?: string;\n  layout?: \"horizontal\" | \"vertical\";\n  className?: string;\n}) {\n  return (\n    <ul\n      data-slot=\"chart-legend\"\n      data-layout={layout}\n      aria-label={label}\n      className={cn(\n        \"m-0 list-none p-0 text-xs\",\n        layout === \"horizontal\"\n          ? \"flex flex-wrap items-center gap-x-4 gap-y-2\"\n          : \"grid gap-3\",\n        className,\n      )}\n    >\n      {items.map((item) => (\n        <li\n          key={item.label}\n          data-slot=\"chart-legend-item\"\n          className=\"flex min-w-0 items-center gap-2\"\n        >\n          {item.dashed ? (\n            <svg\n              aria-hidden=\"true\"\n              data-slot=\"chart-legend-swatch\"\n              viewBox=\"0 0 14 2\"\n              className=\"h-0.5 w-3.5 shrink-0 overflow-visible\"\n            >\n              <line\n                x1=\"1\"\n                y1=\"1\"\n                x2=\"13\"\n                y2=\"1\"\n                stroke={item.color}\n                strokeWidth=\"2\"\n                strokeLinecap=\"round\"\n                strokeDasharray=\"2 4\"\n              />\n            </svg>\n          ) : (\n            <span\n              aria-hidden=\"true\"\n              data-slot=\"chart-legend-swatch\"\n              className=\"size-2 shrink-0 rounded-full\"\n              style={{\n                backgroundColor: item.color,\n                boxShadow: `0 0 0 2px color-mix(in oklab, ${item.color} 16%, transparent)`,\n              }}\n            />\n          )}\n          <span className=\"min-w-0 break-words text-muted-foreground\">\n            {item.label}\n          </span>\n          {item.value != null && (\n            <span className=\"ms-auto ps-3 font-medium text-foreground tabular-nums\">\n              {item.value}\n            </span>\n          )}\n        </li>\n      ))}\n    </ul>\n  );\n}\n"
    }
  ],
  "docs": "Documentation: https://ui.overtrue.xyz/components/chart-legend. Requires an initialized shadcn/ui project with Tailwind CSS v4."
}
