# Sparkline

A word-sized trend. The line is in the de-emphasis ink; only the latest point carries the accent. Gaps where data is missing stay gaps.

- Registry name: `sparkline` (`@candor/sparkline`)
- Tier: Pro. Installing it needs a Pro, Premium or Team licence key: the person runs `npx candor-ui key <key>` themselves; never ask for the key in chat or write it to a file.
- Docs: https://candor.themethodic.com/docs/sparkline

## Install

```bash
npx candor-ui add sparkline
```

Run `npx candor-ui@latest init` once first (https://candor.themethodic.com/get-started.md). Without the CLI: `npx shadcn@latest add @candor/sparkline`.
It brings in: locale, utils.

## Example

```tsx
"use client"

import { Sparkline } from "@/components/sparkline"

const repos: { name: string; deploys: (number | null)[] }[] = [
  { name: "api", deploys: [3, 4, 2, 5, 6, 4, 7, 5] },
  { name: "web", deploys: [6, 5, null, 4, 7, 8, 6, 9] },
  { name: "workers", deploys: [2] },
]

export default function Example() {
  return (
    <ul className="flex max-w-xs flex-col divide-y rounded-xl border bg-card px-4">
      {repos.map((r) => (
        <li key={r.name} className="flex items-center justify-between gap-4 py-2 text-sm">
          <span className="font-mono text-xs">{r.name}</span>
          <Sparkline values={r.deploys} label={`Deploys to Production per week, ${r.name}`} />
        </li>
      ))}
    </ul>
  )
}
```

## <Sparkline>

Props:

- `values: (number | null)[]`: The points in order; null leaves a gap. Fewer than two numbers shows "Not enough data".
- `width?: number | undefined` (default `80`): In pixels. Defaults to 80.
- `height?: number | undefined` (default `24`): In pixels. Defaults to 24.
- `label: string`: What the trend is, read by assistive tech.
- `className?: string | undefined`

## Strings (`sparkline`)

The fixed words, English by default. Override any of them under `sparkline` in `<LocaleProvider strings={{ sparkline: { … } }}>`; the table is exported as `sparklineStrings`.

- `notEnoughData`: Not enough data

## Rules for using Candor UI

- Components take plain typed data. Never pass model output as HTML or render it as a link; messages are typed blocks.
- A control that can't be used says why: wrap it in `<Locked reason="…">`, don't just disable it.
- Don't show a value you don't have: leave it out (it renders as —) rather than guess. An estimate is labelled as one.
- Nothing is pre-selected in a decision a person makes, and the agent is named from your app's data, never from model output.
- Your app's words go in `LocaleProvider` (fixed strings) and `TermsProvider` (nouns); entity kinds and agent roles in `EntityKindsProvider` and `AgentRolesProvider`.
