Experiment Card
The test and its status, the leading variant with its lift and a significance meter, each variant on a small bar, and one sentence that says what to do. Switch between metrics and the rows roll. Ship a winner or stop the test in place; the statistics are exported as plain functions.
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 Layro's Experiment Card for this.
Install it: npx shadcn@latest add @layro/experiment-card
(the @layro registry is set up in components.json, with LAYRO_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 @layro registry with your CLI token: see the Namespaced tab.
Usage
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.
| Prop | Type | Notes |
|---|---|---|
namerequired | string | — |
variantsrequired | ExperimentVariant[] | — |
metrics | ExperimentMetric[] | The first one is primary: it decides significance and the winner gate. |
alpha | number | Significance level. Default 0.05. |
power | number | Power used for the "more visitors" estimate. Default 0.5: where the z-test crosses if the rates hold. |
visitorsPerDay | number | Total visitors a day across all variants. Default: worked out from `startedAt`. |
startedAt | Date | number | string | — |
now | Date | number | Fix the clock, for screenshots and tests. |
maxDays | number | Past this many more days, a test reads Inconclusive. Default 60. |
significant | boolean | Your platform's own verdict, overriding the z-test. |
metric | string | — |
defaultMetric | string | — |
onMetricChange | (metric: string) => void | — |
outcome | ExperimentOutcome | null | — |
defaultOutcome | ExperimentOutcome | null | — |
onOutcomeChange | (outcome: ExperimentOutcome | null) => void | — |
onPickWinner | (variantId: string, info: PickInfo) => void | Promise<void> | May return a promise. |
onStop | () => void | Promise<void> | May return a promise. Leave out to hide Stop test. |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLayro foundations, installed alongside it
layro-themebuttondropdown-menusegmented-controlStates
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
Lifetime access
Every component, and everything we ship next.
- All 232 components, source included
- Every template, and everything released after you buy
- shadcn CLI or download — React 18/19, Tailwind v4
- One payment. No subscription.