Experiment Results
1 variantAn 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
SignificantDay 14 of 21 · 48,210 users · Primary: Conversion
- 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%
"use client";
import { ExperimentResults } from "@/components/premium/experiment-results";
export function ExperimentResultsAbTestPreview() {
return (
<div className="w-full px-4 py-10">
<ExperimentResults />
</div>
);
}
Source code is locked
Get access to install premium components and view the full source.
Open dashboardInstall
API Reference
Every prop is optional unless marked required. Data, copy, and colors default to the sample content.
ExperimentResults9 props
experimentExperiment to show. Defaults to the sample checkout test.
ExperimentlabelsText 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; }>formattersFormatter overrides for values, lifts, and user counts.
Partial<ExperimentFormatters>targetChance to beat control that counts as a win, 0 to 100. Defaults to 95.
numberDefault
95defaultMetricIdMetric tab selected on mount. Defaults to the primary metric.
stringdefaultTrendOpenOpens the cumulative lift chart on mount.
booleanDefault
falseonShipRuns the ship after it is confirmed; a rejected promise shows an error.
((winnerId: string) => void | Promise<void>)onMetricChangeCalled with the metric id when the tab changes.
((metricId: string) => void)classNameClasses merged onto the root element.
string
BeatControlMeter5 props
variantRequiredLeading variant for the selected metric.
ExperimentVariantprobabilityRequiredIts chance to beat control, 0 to 100.
numbertargetRequiredDecision threshold drawn as a target line, 0 to 100.
numberactiveRequiredFills the track once the card is in view.
booleanlabelsRequiredText 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
statusRequiredStatus that sets the label and tint.
"running" | "significant" | "shipped"labelsRequiredStatus 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>classNameClasses merged onto the root element.
string
IntervalBar9 props
lowRequiredLower bound of the lift interval in percent.
numberhighRequiredUpper bound of the lift interval in percent.
numberestimateRequiredPoint estimate of the lift in percent.
numberrangeRequiredAxis half-range in percent; the axis runs from -range to +range.
numberactiveRequiredCollapsed at zero until true, then the interval grows out from zero.
booleandelaySeconds before the first grow-in.
numberDefault
0baselineDraws only the zero line and a muted dot, for the control row.
booleanDefault
falselabelAccessible summary, such as "+9.3%, 95% interval +3.1% to +15.6%".
stringclassNameClasses merged onto the root element.
string
LiftTrend6 props
pointsRequiredDaily cumulative lift, oldest first.
readonly LiftPoint[]viewKeyRequiredKey that replays the draw when the metric changes.
stringopenRequiredWhether the chart is shown.
booleanonOpenChangeRequiredCalled when the disclosure is toggled.
(open: boolean) => voidlabelsRequiredText 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">formatLiftRequiredFormats the latest lift beside the toggle.
(lift: number) => string
ShipDialog5 props
winnerRequiredVariant that will get all traffic.
ExperimentVariantvariantsRequiredEvery variant, for the traffic split.
readonly ExperimentVariant[]onConfirmRequiredCalled when the ship is confirmed.
() => voidonCancelRequiredCalled when the dialog is dismissed.
() => voidlabelsRequiredDialog 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
variantRequiredVariant shown in this row.
ExperimentVariantresultRequiredResult for the selected metric.
VariantResultmetricRequiredSelected metric, passed to the value formatter.
ExperimentMetricrangeRequiredAxis half-range in percent shared by every row.
numberactiveRequiredGrows the interval in once the card is in view.
booleandelayRequiredSeconds before this row's interval grows in.
numberdimmedRequiredFades the row back after another variant ships.
booleanwinnerRequiredShows the winner tag after shipping.
booleanlabelsRequiredText 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">formatRequiredValue, lift, and user formatters.
ExperimentFormatters
Types7 types
The object types these props take, field by field.
Experiment7 fields
nameRequiredExperiment name shown in the header.
stringstatusRequiredStatus when the card mounts. Shipping moves it to "shipped".
ExperimentStatusruntimeRequiredRuntime caption, such as "Day 14 of 21".
stringprimaryMetricIdRequiredId of the metric that decides the winner.
stringvariantsRequiredVariants, control first.
ExperimentVariant[]metricsRequiredMetrics, one tab each.
ExperimentMetric[]guardrailsRequiredGuardrail metrics summarized in the footer.
Guardrail[]
ExperimentFormatters3 fields
valueRequiredFormats a metric value, such as "3.41%" or "$5.12".
(value: number, metric: ExperimentMetric) => stringliftRequiredFormats a relative lift in percent, such as "+9.3%".
(lift: number) => stringusersRequiredFormats a user count, such as "48,210".
(users: number) => string
ExperimentVariant5 fields
idRequiredUnique id, used as the key in each metric's results.
stringnameRequiredVariant name shown in the row and the ship dialog.
stringtrafficRequiredShare of traffic in percent, such as 34.
numberisControlMarks the baseline every other variant is compared against.
booleandotClassNameRequiredDot class that identifies the variant, such as `bg-blue-500`.
string
ExperimentMetric6 fields
idRequiredUnique id, used as the tab value.
stringlabelRequiredTab and header label, such as "Conversion".
stringkindRequiredHow values read: a percentage or a currency amount.
"percent" | "currency"decimalsRequiredFraction digits shown for values.
numberresultsRequiredResults keyed by variant id.
Record<string, VariantResult>trendRequiredDaily cumulative lift of the leading variant, oldest first.
LiftPoint[]
Guardrail2 fields
nameRequiredGuardrail metric name, such as "Payment errors".
stringstatusRequiredOk, watch (drifting), or breach (over its limit).
GuardrailStatus
VariantResult6 fields
usersRequiredUsers counted for this metric.
numbervalueRequiredMetric value, such as 3.41 for 3.41% or 5.12 for $5.12.
numberliftRequiredRelative lift vs control in percent. Control uses 0.
numberlowRequiredLower bound of the lift's confidence interval in percent.
numberhighRequiredUpper bound of the lift's confidence interval in percent.
numberprobabilityRequiredChance to beat control, 0 to 100. Ignored for the control.
number
LiftPoint3 fields
liftRequiredCumulative relative lift on that day in percent.
numberlowRequiredLower bound of the confidence band in percent.
numberhighRequiredUpper bound of the confidence band in percent.
number