caliper uidocs

Cohort retention

Pro

A triangle of retention by sign-up cohort.

Installs components/ui/cohort-retention.tsxDepends on d3-shapeMotion shared motion tokens
pnpm dlx shadcn@latest add @caliper/cohort-retention
Monthly retention by sign-up month
JoinedSizeM0M1M2M3M4M5M6
May420
Jun465
Jul510
Aug488
Sep540
Oct603
Average100%85%74%66%60%56%53%

Monthly retention by sign-up month
CohortSizeMonth 0Month 1Month 2Month 3Month 4Month 5Month 6
May420420336290262244231222
Jun465465381330298277262
Jul510510428372339318
Aug488488420371344
Sep540540475430
Oct603603540

When to use #

Use it for

  • Judging product stickiness over time.

Skip it when

  • There are too few users to fill the cohorts.

Installation #

terminal
pnpm dlx shadcn@latest add @caliper/cohort-retention

Adds its 4 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage #

Import it from your copy of the source. The example behind the preview comes with the source.

example.tsx
import { CohortRetention } from "@/components/ui/cohort-retention"

The worked example comes with Pro

The 19-line example behind the preview opens here with a Pro or Team licence.

Checking your licence…

API reference #

CohortRetention

component
PropTypeDefault
label *string—
cohorts *readonly Cohort[]—
periodLabelstring"Month"
loadingboolean—
errorstring—
classNamestring—

Accessibility #

It exposes grid and status semantics, with aria-label, aria-busy and aria-hidden kept in step with state. Changes that matter are announced through a live region.

No custom key handling; Tab and the native activation keys do the work.

Motion #

Transitions use the shared duration and easing tokens. Under prefers-reduced-motion those tokens collapse to instant and travel distances go to zero, so state changes still happen without movement.