twelfth

Foundations

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.

@twelfth/scenario-comparisonuitooltip
Low
32028-day rate
Mid
1,0567-day rate
High
2,753Seasonal rate

Examples

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.

Low
32028-day rate
Mid
1,0567-day rate
High
2,753Seasonal 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.

Low
32028-day rate
Mid
1,0567-day rate
High
2,753Seasonal 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.

Low
32028-day rate
Mid
1,0567-day rate
High
Unknownno uplift

Price suggestions

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

Lower
$39.95
Middle
$44.95
Upper
$49.95

Installation

  1. 1. Add the block. It brings what it builds on (tooltip) with it.

    terminal
    npx shadcn@latest add https://ui.twelfth.ai/r/scenario-comparison.json
  2. 2. Optional: register the namespace in components.json to write npx shadcn add @twelfth/scenario-comparison from then on.

    components.json
    {
      "registries": {
        "@twelfth": "https://ui.twelfth.ai/r/{name}.json"
      }
    }

API reference

ScenarioComparison

PropTypeDefaultDescription
label*string—Accessible description, including units and period.
rows*{ 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.
classNamestring—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.

No bad cookies on these shelves.

Essential cookies keep the store running. Analytics only if you choose.