# RubricStrip (/docs/charts/rubric-strip)

RubricStrip encodes each criterion twice: bar length is the score, bar thickness is that criterion's share of the total
weight. A heavy criterion scoring poorly therefore carries more ink than a light one scoring well, which a table of the
same numbers hides. There is no total bar and none can be added; the summary names the highest and lowest criterion
instead of a weighted average, because one number throws away the structure. A `target` draws a single pass line across
every row.

```tsx
import { RubricStrip } from "@microcharts/react/rubric-strip";

<RubricStrip
  data={[
    { label: "Correctness", score: 0.92, weight: 3 },
    { label: "Coverage", score: 0.78, weight: 2 },
    { label: "Clarity", score: 0.65, weight: 1 },
    { label: "Style", score: 0.41, weight: 1 },
  ]}
  target={0.7}
  title="Model eval"
/>
```

## Install

```tsx
import { RubricStrip } from "@microcharts/react/rubric-strip";

<RubricStrip
  data={[
    { label: "Correctness", score: 0.92, weight: 3 },
    { label: "Coverage", score: 0.78, weight: 2 },
    { label: "Clarity", score: 0.65, weight: 1 },
    { label: "Style", score: 0.41, weight: 1 },
  ]}
  title="Model eval"
/>
```

Setup (package + stylesheet): [Quickstart](/docs/quickstart#set-up-with-an-ai-agent) or paste [`/agent-setup.md`](/agent-setup.md) into your agent.

## Try it

```tsx
import { RubricStrip } from "@microcharts/react/rubric-strip/interactive";

<RubricStrip
  data={criteria}
  target={0.70}
/>
```

## When to use it

Use it for model and code-review scorecards and for weighted vendor comparison. For a single criterion use Bullet; for
parts of a whole use SegmentedBar.

## Sizing

**table cell**

```tsx
<RubricStrip data={row.criteria} labels={false} width={60} height={24} />
```

**with target**

```tsx
<RubricStrip data={criteria} target={0.7} />
```

## Variants

```tsx
<RubricStrip
  data={[
    { label: "Lint", score: 1 },
    { label: "Types", score: 1 },
    { label: "Tests", score: 0.8 },
    { label: "Docs", score: 0.5 },
  ]}
/>
```

## Edge cases

```tsx
// a score of 2 on a [0, 1] domain draws a full-length bar instead of
// overflowing the track
<RubricStrip data={[{ label: "Bonus", score: 2, weight: 1 }]} />
```

```tsx
<RubricStrip data={[{ label: "Overall fit", score: 0.83 }]} />
```

A score outside the domain clamps to a full-length bar rather than overflowing the track, and the component logs a dev
warning. Omit `weight` and every criterion carries the same thickness, which is what the unweighted variant above shows.

## Four homes

**In a sentence**

```tsx
<p>
  Model eval scorecard{" "}
  <span className="mc-inline">
    <RubricStrip data={criteria} summary={false} />
  </span>{" "}
  — 78% weighted, accuracy weakest.
</p>
```

**In a table cell**

```tsx
<td>
  <RubricStrip data={criteria} />
</td>
```

**In a KPI card**

```tsx
<div className="kpi">
  <span className="figure">78%</span>
  <span className="unit">weighted score</span>
  <RubricStrip data={criteria} />
</div>
```

**In a tab header**

```tsx
<button className="tab">
  GPT-4 <RubricStrip data={criteria} />
</button>
```

## Accessibility

The accessible name reports the count and the extremes: **"4 criteria; highest Lint (1), lowest Docs (0.5)."** The
interactive entry roves the criteria, announcing each one's score and its weight share of the total (**"Coverage: 0.78,
weight 29% of total."**).

The interactive entry follows the shared [interaction contract](/docs/accessibility#one-interaction-contract):
arrow keys rove between units on both axes, `Home` and `End` jump to the ends, and a click, tap, `Enter` or
`Space` selects a unit — pinning its readout so it survives blur, until you select it again, press `Escape`, or
press outside the chart. On touch, a tap pins and a drag scrubs.

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `data` (required) | `{ label, score, weight? }[]` | Criteria; weights default equal. |
| `target` | `number` | Pass target — one tick across all rows. |
| `labels` | `boolean` | Criterion names in the left gutter. |
| `animate` | `boolean` | (interactive) Opt-in entrance motion when the chart mounts client-side — add `import "@microcharts/react/motion"` once. Inert on the server, on hydrated server HTML, and under `prefers-reduced-motion`. |

Plus the shared grammar — `data`, `domain`, `color`, `title`, `summary`, `format` — and the layout props (`width`, `height`, `className`, `style`) that every chart accepts. Interactive entries also share `animate` and `live`, and — wherever a chart has more than one navigable unit — `onActive`, `onSelect`, `selectedIndex` and `defaultSelectedIndex`; and — wherever the chart shows a hover value — `readout`. See [the shared grammar](/docs/quickstart#the-shared-grammar).
