# Subscore card

Weighted subscores behind an overall score. Each has its weight, score and a bar toned by how it's doing. One that can't be computed says what it needs ("Not computed — needs test results") and is left out of the total, which says so.

- Registry name: `subscore-card` (`@candor/subscore-card`)
- 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/subscore-card

## Install

```bash
npx candor-ui add subscore-card
```

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

## Example

```tsx
"use client"

import { SubscoreCard } from "@/components/subscore-card"
import type { Subscore } from "@/lib/data"

const subscores: Subscore[] = [
  { label: "Tests pass", score: 94, max: 100, weight: 3 },
  { label: "Coverage over 75%", score: 82, max: 100, weight: 2 },
  { label: "Migrations reversible", score: 60, max: 100, weight: 2 },
  { label: "User impact known", score: null, max: 100, weight: 1, needs: "session analytics" },
]

export default function Example() {
  return <SubscoreCard className="max-w-md" title="Release readiness" subscores={subscores} />
}
```

## <SubscoreCard>

Props:

- `title: string`: What the overall score measures, shown above the total.
- `subscores: Subscore[]`: The parts of the score, each with weight, score and max; a null score is left out of the total and says what it needs.
- `className?: string | undefined`

## Strings (`subscoreCard`)

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

- `outOf100`:  / 100
- `partial`: {left} of {total} not computed; the score covers the rest.
- `notComputed`: Not computed
- `needs`: Needs {what}
- `moreData`: more 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`.
