Experiment Card

An A/B test answered at a glance, with no winner before it is significant.

PROGet Experiment Card and 168 other Pro components with pro lifetime — Get Pro

Category
Data & feedback
Access
Pro
Source
913 lines · one file
States
6 drawn
Added
21 Oct 2026

The decision inside it

No winner before the result is significant

While the answer is "not yet" the card says how far off it is ("About 2,200 more visitors, under a day") and the only button is Call it early, which asks again and is recorded. Once significant, the button becomes Ship B.

When to use it

Use Experiment Card for an A/B test: who is ahead, by how much and how close to significant, with Ship only once it is significant and a separate, recorded Call it early. Pass visitors and conversions per variant; the statistics are worked out for you.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Liro's Experiment Card for this.
Install it: npx shadcn@latest add @liro/experiment-card
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/experiment-card.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.

Usage

components/checkout-test.tsx
import { ExperimentCard, type PickInfo } from "@/components/ui/experiment-card";

export function CheckoutTest({ ship, stop }: { ship: (id: string, info: PickInfo) => Promise<void>; stop: () => Promise<void> }) {
  return (
    <ExperimentCard
      name="Checkout: one-page form"
      variants={[
        { id: "a", name: "Current checkout", control: true, visitors: 9812, results: { conversion: { conversions: 402 } } },
        { id: "b", name: "One-page form", visitors: 9790, results: { conversion: { conversions: 471 } } },
      ]}
      metrics={[{ id: "conversion", label: "Conversion", kind: "rate" }]}
      startedAt="2026-10-12"
      onPickWinner={ship}
      onStop={stop}
    />
  );
}

API reference

“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

TypeNotes
namestring Yes–
variantsExperimentVariant[] Yes–
metricsExperimentMetric[] NoThe first one is primary: it decides significance and the winner gate.
alphanumber NoSignificance level. Default 0.05.
powernumber NoPower used for the "more visitors" estimate. Default 0.5: where the z-test crosses if the rates hold.
visitorsPerDaynumber NoTotal visitors a day across all variants. Default: worked out from `startedAt`.
startedAtDate | number | string No–
nowDate | number NoFix the clock, for screenshots and tests.
maxDaysnumber NoPast this many more days, a test reads Inconclusive. Default 60.
significantboolean NoYour platform's own verdict, overriding the z-test.
metricstring No–
defaultMetricstring No–
onMetricChange(metric: string) => void No–
outcomeExperimentOutcome | null No–
defaultOutcomeExperimentOutcome | null No–
onOutcomeChange(outcome: ExperimentOutcome | null) => void No–
onPickWinner(variantId: string, info: PickInfo) => void | Promise<void> NoMay return a promise.
onStop() => void | Promise<void> NoMay return a promise. Leave out to hide Stop test.

Dependencies

npm packages

clsxframer-motionlucide-reacttailwind-merge

Liro foundations, installed alongside it

liro-themebuttondropdown-menusegmented-control

States

All of them are drawn by the component. None is left for you to design.

  • Running
  • Significant
  • Inconclusive
  • Called early
  • Shipped
  • Stopped

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances