Xzero UI
Pro library

Cohort retentionPro

A cohort retention triangle that morphs into retention curves and rewashes by segment.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/cohort-retention
Live · keyboard ready

Use this on a growth or customer success dashboard to compare how signup cohorts retain. Replace simulate() in cohort-data.ts with your cohort sizes and retained counts per month; rates, averages, headline figures and deltas are derived from them.

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/cohort-retention

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { CohortRetention } from "@/components/xzero/blocks/cohort-retention/cohort-retention";

export default function GrowthPage() {
  return (
    <section>
      <CohortRetention />
    </section>
  );
}

API reference

CohortRetention

A cohort retention triangle that morphs into retention curves, with segment filters and a keyboard-navigable cell cursor. Cohort sizes and retained counts come from simulate() in cohort-data.ts.

No props.

Keyboard interactions

KeysAction
Arrow keysMove the cell cursor between cohorts (rows) and months (columns).
Home / EndJump to the first or last month of the current cohort.
EscapeClears the cursor.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Guidance for AI tools

Blocks are complete, self-contained screens with sample data. Replace the sample data and connect the callbacks described above. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components