Skip to content
GitHub (opens in a new tab)

ExperimentCard

A compact A/B or A/B/n experiment with its status, result and one decision.

stableOrganismcontracts/experimentcard.json

Preview

ExperimentCard

An A/B or A/B/n experiment: status, traffic split, metric per variant and one decision.

Master

A running experiment with B leading. Stop opens a kit AlertDialog; Cancel returns focus to the button. Variants shows every status.

Checkout button copy

Running
Conversion rateStarted 02 Nov · ends 16 Nov
  • Variant A: Checkout v14.1%conversion rate · 50% of traffic
  • Variant B: Checkout v2Leading4.6%conversion rate · 50% of traffic

84% sure B is better. 95% in about 4 days.

Usage

Status, Winner and Leading are words in a Badge. Ship winner is the one solid primary and only appears on a concluded experiment with a winner; a concluded experiment with no winner reads Inconclusive and offers Extend.

Do's

  • show a running or finished experiment in a product or growth view
  • let someone ship the winner or stop a test with a confirmation
  • show a draft A/B/n split before it starts

Don'ts

  • a feature flag on or off — Switch
  • a single KPI — Scorecard
  • a recommendation to act on — InsightCard
<ExperimentCard
  name="Checkout button copy"
  metricLabel="Conversion rate"
  status="running"
  dates="Started 02 Nov · ends 16 Nov"
  variants={variants}
  confidenceNote="84% sure B is better. 95% in about 4 days."
  onStop={stop}
  onView={view}
/>

A compact A/B or A/B/n experiment: status in words, the metric and traffic split under each variant's value ("paid within 7 days · 50%"), a confidence note in plain words and one decision (Ship winner, Stop, Extend, Start). Ship and Stop confirm with a kit AlertDialog.

When to use

  • show a running or finished experiment in a product or growth view
  • let someone ship the winner or stop a test with a confirmation
  • show a draft A/B/n split before it starts

When not to use

  • a feature flag on or off — Switch
  • a single KPI — Scorecard
  • a recommendation to act on — InsightCard

What an agent reads

import { ExperimentCard } from "agentic-ds-kit";
must
  • article aria-labelledby the h3 name
  • status, Winner and Leading are words in a kit Badge, not colour alone
  • variants are a list; each says "Variant B:" to screen readers; a missing value says "no data yet"
  • Ship and Stop open a kit AlertDialog; Cancel returns focus to the button that opened it
  • aria-busy while loading; the error is role=alert
defaults
  • extendLabel Extend 7 days
  • loading false
stops if
  • Do not invent a local ABTestCard or VariantList
  • Do not ship or stop without the AlertDialog
  • Do not mark the winner by colour alone
  • Do not use raw hex

From contracts/experimentcard.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
namestringYes——
metricLabelstringYes—Shown in the meta line and, lowercased, under each value with the traffic share.
statusdraft | running | concluded | stoppedYes—Concluded with no winner reads "Inconclusive".
variantsarrayYes—{ id, label, traffic, value?, isWinner?, isLeading? }[]; lettered A, B, C…
datesstringNo——
confidenceNotestringNo—Plain words, e.g. "88% sure B is better. 95% in about 3 days." Body-sm in muted text.
onViewfunctionNo——
onShipfunctionNo—(variantId) => void, after the AlertDialog. The one solid primary.
onStopfunctionNo—After a danger AlertDialog.
onStartfunctionNo——
onEditfunctionNo——
onExtendfunctionNo——
extendLabelstringNoExtend 7 days—
loadingbooleanNofalse—
errorstringNo——
onRetryfunctionNo——
  • Component
    →

    Switch

    Immediate on/off setting.

  • Component
    →

    Scorecard

    one KPI with label, value, optional delta/trend/hint/badge

  • Component
    →

    InsightCard

    A recommended insight or opportunity as a compact card, with tone and optional actions.

  • Component
    →

    AlertDialog

    Must-choose overlay that interrupts until the user cancels or confirms.