# Scenario comparison

Three alternatives on a linear scale centred on Mid. Colour and marker shapes identify each scenario; distance shows the spread, not a recommendation. Forecast and leftover stock stay outside the comparison.

Docs: https://ui.twelfth.ai/scenario-comparison · Category: Foundations · Updated: 2026-11-23

## Install

```bash
npx shadcn@latest add https://ui.twelfth.ai/r/scenario-comparison.json
```

```tsx
import { ScenarioComparison } from "@/components/ui/scenario-comparison"
```

## Mid-centred range

Illustrative order units through 2027-01-01: High is further from Mid than Low. The dashed line anchors Mid, not a target or recommendation.

```tsx
<ScenarioComparison label="Order units through 2027-01-01"
  rows={[
    { label: "Low", value: "320", amount: 320, detail: "28-day rate" },
    { label: "Mid", value: "1,056", amount: 1056, detail: "7-day rate" },
    { label: "High", value: "2,753", amount: 2753, detail: "Seasonal rate" },
  ]}
/>
```

## Distance from Mid

Same values and linear scale, one row per scenario. Bars extend from Mid; they do not start at zero. Colour is identity, not good or bad.

```tsx
<ScenarioComparison variant="bars" label="Order units, distance from Mid"
  rows={[
    { label: "Low", value: "320", amount: 320, detail: "28-day rate" },
    { label: "Mid", value: "1,056", amount: 1056, detail: "7-day rate" },
    { label: "High", value: "2,753", amount: 2753, detail: "Seasonal rate" },
  ]}
/>
```

## No supported high scenario

The unavailable alternative keeps its label and reason but has no plotted marker. Never substitute zero or invent a position.

```tsx
{ label: "High", value: "Unknown", detail: "no uplift" }
```

## Price suggestions

Illustrative AUD prices including GST, not calculated recommendations or statistical bounds. A smaller numeric spread uses the same relative scale.

```tsx
<ScenarioComparison label="Price suggestions in AUD, including GST"
  rows={[
    { label: "Lower", value: "$39.95", amount: 39.95 },
    { label: "Middle", value: "$44.95", amount: 44.95 },
    { label: "Upper", value: "$49.95", amount: 49.95 },
  ]}
/>
```

## ScenarioComparison props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `label` (required) | `string` |  | Accessible description, including units and period. |
| `rows` (required) | `{ label: string; value: string; amount?: number; detail?: string }[]` |  | Three labelled alternatives. Value is caller-formatted; optional finite amount controls position, never parsed from text. Omit amount for an unknown alternative. |
| `variant` | `"range" \| "bars"` | `"range"` | A shared range or one diverging bar per row, both centred on the second alternative. |
| `className` | `string` |  | Additional layout classes. |

## Notes

- Labels, values and reasons remain visible without hover or colour perception. With no numeric Mid, show text only.
- Hover a value or move along the line to highlight the matching alternative. Focus the comparison and use Left/Right, Home/End or Escape for the same readout without a pointer.
- A symmetric linear scale preserves relative distances, including when the scenario names are not numerically ordered. Equal values share a position.
- Supply the basis and caveats beside the component. Call these bounds only when the underlying method supports that claim.
- For quick inline answers, prefer three plain numeric columns. Use these visual treatments when reading the spread is the task.

---

twelfth UI: Open-source (MIT) shadcn components for category managers and retail buying teams, by twelfth (https://twelfth.ai). React and TypeScript on shadcn's Base UI styles and Tailwind CSS v4. Components take plain props and fetch no data. Every block: https://ui.twelfth.ai/llms.txt
