{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sparkline-demo",
  "title": "Sparkline Demo",
  "description": "A worked example of Sparkline: A trend line small enough for a table cell, with the change since the first value and a readout you can move along it.",
  "registryDependencies": [
    "https://ui.tinkererslabs.com/r/sparkline.json"
  ],
  "files": [
    {
      "path": "components/demos/sparkline-demo.tsx",
      "content": "\"use client\"\n\nimport { Sparkline } from \"@/registry/default/sparkline/sparkline\"\n\nconst week = [\n  \"Oct 20\",\n  \"Oct 21\",\n  \"Oct 22\",\n  \"Oct 23\",\n  \"Oct 24\",\n  \"Oct 25\",\n  \"Oct 26\",\n  \"Oct 27\",\n  \"Oct 28\",\n  \"Oct 29\",\n  \"Oct 30\",\n  \"Oct 31\",\n  \"Nov 1\",\n  \"Nov 2\",\n]\n\nconst routes = [\n  {\n    path: \"GET /search\",\n    p95: [182, 176, 190, 201, 188, 170, 164, 171, 168, 159, 162, 150, 148, 141],\n  },\n  {\n    path: \"POST /checkout\",\n    p95: [\n      312,\n      305,\n      298,\n      320,\n      344,\n      351,\n      362,\n      null,\n      371,\n      380,\n      366,\n      390,\n      402,\n      398,\n    ],\n  },\n  {\n    path: \"GET /orders/:id\",\n    p95: [88, 90, 87, 91, 89, 88, 90, 92, 89, 88, 90, 91, 89, 90],\n  },\n]\n\nexport function SparklineDemo() {\n  return (\n    <div className=\"grid w-full max-w-[34rem] gap-4\">\n      <div className=\"bg-card text-card-foreground border-border rounded-xl border p-4\">\n        <p className=\"text-muted-foreground text-sm\">Active users</p>\n        <div className=\"mt-1 flex items-end justify-between gap-4\">\n          <p className=\"text-2xl font-semibold\">2,418</p>\n          <Sparkline\n            area\n            className=\"w-40\"\n            data={[\n              1980, 2010, 2104, 2050, 1890, 1760, 2120, 2205, 2240, 2190, 2010,\n              1930, 2330, 2418,\n            ]}\n            height={36}\n            label=\"Daily active users, last 14 days\"\n            labels={week}\n          />\n        </div>\n      </div>\n\n      <div className=\"border-border min-w-0 overflow-x-auto rounded-xl border\">\n        <table className=\"w-full min-w-[22rem] text-sm\">\n          <caption className=\"text-muted-foreground px-4 pt-3 text-left text-xs\">\n            p95 latency in milliseconds, last 14 days. Lower is better.\n          </caption>\n          <thead>\n            <tr className=\"text-muted-foreground border-border border-b text-left text-xs\">\n              <th className=\"px-4 py-2 font-medium\" scope=\"col\">\n                Route\n              </th>\n              <th className=\"px-4 py-2 font-medium\" scope=\"col\">\n                Today\n              </th>\n              <th className=\"px-4 py-2 font-medium\" scope=\"col\">\n                Trend\n              </th>\n            </tr>\n          </thead>\n          <tbody>\n            {routes.map((route) => (\n              <tr\n                className=\"border-border border-b last:border-0\"\n                key={route.path}\n              >\n                <th\n                  className=\"px-4 py-3 text-left font-mono text-xs font-normal\"\n                  scope=\"row\"\n                >\n                  {route.path}\n                </th>\n                <td className=\"px-4 py-3 whitespace-nowrap tabular-nums\">\n                  {route.p95[route.p95.length - 1]} ms\n                </td>\n                <td className=\"px-4 py-2\">\n                  <Sparkline\n                    className=\"w-32 sm:w-40\"\n                    data={route.p95}\n                    format={{ style: \"unit\", unit: \"millisecond\" }}\n                    goodDirection=\"down\"\n                    label={`${route.path} p95 latency`}\n                    labels={week}\n                    table\n                  />\n                </td>\n              </tr>\n            ))}\n          </tbody>\n        </table>\n      </div>\n    </div>\n  )\n}\n",
      "type": "registry:example"
    }
  ],
  "type": "registry:example"
}