AI unit economics
Shown as Contrail, a made-up product
CAC against LTV for three acquisition channels as comet trails on one chart, with a replay, a payback curve, a next-quarter budget mix you can drag, and a growth agent that proposes the plan.
Installation
pnpm dlx shadcn@latest add "https://propui.dev/r/contrail-economics.json?token=…"Adds the piece to components/propui/04-contrail-economics/ and installs motion. Needs a free account: sign in and the command includes your token. Fonts load from Prop UI; download the zip to self-host them.
When to use
Reach for it when
- Comparing acquisition channels on what an account costs against what it is worth.
- Showing how each channel's efficiency moved month by month, with the product events that moved it.
- Planning next quarter's budget mix and seeing the projected accounts, blended CAC and LTV : CAC before committing.
Something else fits when
- Revenue movement inside the customer base: Revenue movement explains new, expansion and churn.
- Traffic and conversion on a site: Traffic analyst fits better.
- A single metric with a forecast: Growth metrics fits better.
Usage
Fills a full window: give it a container with a definite height.
import Piece from "@/components/propui/04-contrail-economics/Section";
export default function Page() {
return (
<main className="h-dvh w-full overflow-hidden">
<Piece />
</main>
);
}Replace CHANNELS in data.ts with your channels' monthly CAC, ARPA and spend, their elasticity and one event each, and MONTHS with your months. LTV, payback, the 3× crossings, the agent's read and the projections are all computed from them and the assumptions.
Your data
Replace these and everything on screen follows.
CHANNELS{ id; label; cac[]; arpa[]; spend[]; elasticity; event }[]- The trails on the chart, the payback curves, the sliders and every figure in the stats.
MONTHS, SHORTstring[]- The scrubber, the stat cell and the flags' month labels.
DEFAULTS{ margin; churn }- The starting gross margin and monthly churn behind every LTV.
TARGETnumber- The highlighted iso-line, the shaded zone above it and which crossings get a flag.
Interactions
- Press Replay to fly all three channels through 18 months while the stats roll; press again to pause.
- Drag the scrubber, or hover a point and click it to focus that channel at that month.
- Pick a channel tab to dim the others; the stats, payback curve and agent follow it.
- Drag a share slider in Next-quarter mix: the other two rebalance and dashed ghost marks show where each channel would land.
- Apply the agent's plan to fill in the mix, and Undo to restore the previous one; click a flag chip to jump to that crossing.
- Open Assumptions to change gross margin and monthly churn; every LTV, ratio, flag and projection recomputes.
- Export a CSV of every month and channel, or Share a link that restores the month, focus and assumptions.
Keyboard
- →or↑
- On the focused chart, move a month forward.
- ←or↓
- On the focused chart, move a month back.
- HomeorEnd
- On the focused chart, jump to the first or last month.
- Esc
- Close the Assumptions popover.
Behaviour
Read from the code: roles, motion, breakpoints and what runs.
Accessibility
- Channel heads differ in shape (circle, square, diamond) as well as colour, and every legend and list repeats the shape.
- The channels are tabs with aria-selected; the scrubber and share sliders are range inputs whose values are read as a month or a share with its projected CAC.
- The agent's read and the toast are polite live regions; the chart and payback curve carry descriptive labels.
- Assumptions is a labelled dialog that closes on Esc or a click outside.
- Colour pairs meet WCAG AA contrast in both themes.
Motion
- Replay steps a month every 240ms; trail heads, ghost marks and payback curves ease to each new position in 0.3s.
- The tab pill slides on a spring and stat values roll.
- Reduced motion makes Replay land straight on the last month and keeps changes instant.
Responsive
- Below 1100px the side panels move under the chart, two across.
- Below 860px the actions take their own row under the title, and the stats form a two-column grid with the month across the top.
- Below 720px the side panels stack.
- Below 560px the padding tightens, the tabs fill the row and middle month labels hide; below 360px the buttons drop their icons and Paid search shortens to Paid.
Performance
- Replay runs one interval only while playing and clears it at the last month.
- The chart is one SVG sized by a ResizeObserver; all data is computed in memory and nothing is fetched.
- No images: one local font file and inline SVG.
Notes for AI
Give your coding assistant the Markdown, not a screenshot.
- Keep the maths in data.ts: LTV = ARPA × margin × Σ(1 − churn)^t for t = 0…11, payback = CAC / (ARPA × margin).
- Derive flags, the agent's read and the plan's projection from the data and assumptions, never from fixed copy.
- Light and dark follow the nearest data-theme attribute, or the system setting. Keep colours in the tokens at the top of post.css.
/p/contrail-economics/markdownThe whole library for assistants: llms.txt, or the MCP server in AI tools and MCP.