Experiment Results

1 variant

An A/B test results card with confidence intervals, a probability-to-beat-control meter, and a ship-the-winner flow.

A/B test

A/B test results with confidence intervals on a zero-lift axis, a probability-to-beat-control meter, and metric tabs that roll every number. Shipping the winner confirms in a dialog, then the status rolls to Shipped and the losing variants fade.

One-page checkout

Significant

Day 14 of 21 · 48,210 users · Primary: Conversion

99.1%One-page chance to beat control
target 95%
  • Control3.12%Baseline
  • One-page3.41%+9.3%
    One-page: +9.3%, interval +3.1% to +15.6%
  • Saved cards first3.05%−2.2%
    Saved cards first: −2.2%, interval −8.4% to +4.1%
+9.3%
  • Page load p95: ok
  • Payment errors: ok
  • Refund rate: watch
2 guardrails OK, 1 watch95% confidence
"use client";

import { ExperimentResults } from "@/components/premium/experiment-results";

export function ExperimentResultsAbTestPreview() {
  return (
    <div className="w-full px-4 py-10">
      <ExperimentResults />
    </div>
  );
}

Install

$ bunx --bun shadcn add @beui-pro/experiment-results-ab-test

API Reference

Every prop is optional unless marked required. Data, copy, and colors default to the sample content.

ExperimentResults9 props
  • experiment

    Experiment to show. Defaults to the sample checkout test.

    Experiment
  • labels

    Text overrides merged over the default labels.

    Partial<{ running: string; significant: string; shipped: string; users: string; primary: string; metricsAriaLabel: string; beatControl: string; target: string; control: string; baseline: string; winner: string; ... 15 more ...; confidence: string; }>
  • formatters

    Formatter overrides for values, lifts, and user counts.

    Partial<ExperimentFormatters>
  • target

    Chance to beat control that counts as a win, 0 to 100. Defaults to 95.

    number

    Default 95

  • defaultMetricId

    Metric tab selected on mount. Defaults to the primary metric.

    string
  • defaultTrendOpen

    Opens the cumulative lift chart on mount.

    boolean

    Default false

  • onShip

    Runs the ship after it is confirmed; a rejected promise shows an error.

    ((winnerId: string) => void | Promise<void>)
  • onMetricChange

    Called with the metric id when the tab changes.

    ((metricId: string) => void)
  • className

    Classes merged onto the root element.

    string
BeatControlMeter5 props
  • variantRequired

    Leading variant for the selected metric.

    ExperimentVariant
  • probabilityRequired

    Its chance to beat control, 0 to 100.

    number
  • targetRequired

    Decision threshold drawn as a target line, 0 to 100.

    number
  • activeRequired

    Fills the track once the card is in view.

    boolean
  • labelsRequired

    Text for the caption and target.

    Pick<{ running: string; significant: string; shipped: string; users: string; primary: string; metricsAriaLabel: string; beatControl: string; target: string; control: string; baseline: string; winner: string; ... 15 more ...; confidence: string; }, "target" | "beatControl">
ExperimentStatusPill3 props
  • statusRequired

    Status that sets the label and tint.

    "running" | "significant" | "shipped"
  • labelsRequired

    Status names.

    Pick<{ running: string; significant: string; shipped: string; users: string; primary: string; metricsAriaLabel: string; beatControl: string; target: string; control: string; baseline: string; winner: string; ... 15 more ...; confidence: string; }, ExperimentStatus>
  • className

    Classes merged onto the root element.

    string
IntervalBar9 props
  • lowRequired

    Lower bound of the lift interval in percent.

    number
  • highRequired

    Upper bound of the lift interval in percent.

    number
  • estimateRequired

    Point estimate of the lift in percent.

    number
  • rangeRequired

    Axis half-range in percent; the axis runs from -range to +range.

    number
  • activeRequired

    Collapsed at zero until true, then the interval grows out from zero.

    boolean
  • delay

    Seconds before the first grow-in.

    number

    Default 0

  • baseline

    Draws only the zero line and a muted dot, for the control row.

    boolean

    Default false

  • label

    Accessible summary, such as "+9.3%, 95% interval +3.1% to +15.6%".

    string
  • className

    Classes merged onto the root element.

    string
LiftTrend6 props
  • pointsRequired

    Daily cumulative lift, oldest first.

    readonly LiftPoint[]
  • viewKeyRequired

    Key that replays the draw when the metric changes.

    string
  • openRequired

    Whether the chart is shown.

    boolean
  • onOpenChangeRequired

    Called when the disclosure is toggled.

    (open: boolean) => void
  • labelsRequired

    Text for the toggle and caption.

    Pick<{ running: string; significant: string; shipped: string; users: string; primary: string; metricsAriaLabel: string; beatControl: string; target: string; control: string; baseline: string; winner: string; ... 15 more ...; confidence: string; }, "trend" | "trendCaption">
  • formatLiftRequired

    Formats the latest lift beside the toggle.

    (lift: number) => string
ShipDialog5 props
  • winnerRequired

    Variant that will get all traffic.

    ExperimentVariant
  • variantsRequired

    Every variant, for the traffic split.

    readonly ExperimentVariant[]
  • onConfirmRequired

    Called when the ship is confirmed.

    () => void
  • onCancelRequired

    Called when the dialog is dismissed.

    () => void
  • labelsRequired

    Dialog text.

    Pick<{ running: string; significant: string; shipped: string; users: string; primary: string; metricsAriaLabel: string; beatControl: string; target: string; control: string; baseline: string; winner: string; ... 15 more ...; confidence: string; }, "shipTitle" | ... 3 more ... | "confirm">
VariantRow10 props
  • variantRequired

    Variant shown in this row.

    ExperimentVariant
  • resultRequired

    Result for the selected metric.

    VariantResult
  • metricRequired

    Selected metric, passed to the value formatter.

    ExperimentMetric
  • rangeRequired

    Axis half-range in percent shared by every row.

    number
  • activeRequired

    Grows the interval in once the card is in view.

    boolean
  • delayRequired

    Seconds before this row's interval grows in.

    number
  • dimmedRequired

    Fades the row back after another variant ships.

    boolean
  • winnerRequired

    Shows the winner tag after shipping.

    boolean
  • labelsRequired

    Text for the baseline and winner tags.

    Pick<{ running: string; significant: string; shipped: string; users: string; primary: string; metricsAriaLabel: string; beatControl: string; target: string; control: string; baseline: string; winner: string; ... 15 more ...; confidence: string; }, "users" | ... 1 more ... | "winner">
  • formatRequired

    Value, lift, and user formatters.

    ExperimentFormatters
Types7 types

The object types these props take, field by field.

Experiment7 fields
  • nameRequired

    Experiment name shown in the header.

    string
  • statusRequired

    Status when the card mounts. Shipping moves it to "shipped".

    ExperimentStatus
  • runtimeRequired

    Runtime caption, such as "Day 14 of 21".

    string
  • primaryMetricIdRequired

    Id of the metric that decides the winner.

    string
  • variantsRequired

    Variants, control first.

    ExperimentVariant[]
  • metricsRequired

    Metrics, one tab each.

    ExperimentMetric[]
  • guardrailsRequired

    Guardrail metrics summarized in the footer.

    Guardrail[]
ExperimentFormatters3 fields
  • valueRequired

    Formats a metric value, such as "3.41%" or "$5.12".

    (value: number, metric: ExperimentMetric) => string
  • liftRequired

    Formats a relative lift in percent, such as "+9.3%".

    (lift: number) => string
  • usersRequired

    Formats a user count, such as "48,210".

    (users: number) => string
ExperimentVariant5 fields
  • idRequired

    Unique id, used as the key in each metric's results.

    string
  • nameRequired

    Variant name shown in the row and the ship dialog.

    string
  • trafficRequired

    Share of traffic in percent, such as 34.

    number
  • isControl

    Marks the baseline every other variant is compared against.

    boolean
  • dotClassNameRequired

    Dot class that identifies the variant, such as `bg-blue-500`.

    string
ExperimentMetric6 fields
  • idRequired

    Unique id, used as the tab value.

    string
  • labelRequired

    Tab and header label, such as "Conversion".

    string
  • kindRequired

    How values read: a percentage or a currency amount.

    "percent" | "currency"
  • decimalsRequired

    Fraction digits shown for values.

    number
  • resultsRequired

    Results keyed by variant id.

    Record<string, VariantResult>
  • trendRequired

    Daily cumulative lift of the leading variant, oldest first.

    LiftPoint[]
Guardrail2 fields
  • nameRequired

    Guardrail metric name, such as "Payment errors".

    string
  • statusRequired

    Ok, watch (drifting), or breach (over its limit).

    GuardrailStatus
VariantResult6 fields
  • usersRequired

    Users counted for this metric.

    number
  • valueRequired

    Metric value, such as 3.41 for 3.41% or 5.12 for $5.12.

    number
  • liftRequired

    Relative lift vs control in percent. Control uses 0.

    number
  • lowRequired

    Lower bound of the lift's confidence interval in percent.

    number
  • highRequired

    Upper bound of the lift's confidence interval in percent.

    number
  • probabilityRequired

    Chance to beat control, 0 to 100. Ignored for the control.

    number
LiftPoint3 fields
  • liftRequired

    Cumulative relative lift on that day in percent.

    number
  • lowRequired

    Lower bound of the confidence band in percent.

    number
  • highRequired

    Upper bound of the confidence band in percent.

    number