CohortGrid
The retention triangle. The staircase is mandatory — padding it with zeroes invents a collapse.
Signature
Density
Viewport
Theme and light/dark are set in the top barWhen to use
The retention triangle.
Accessibility
Each chart ships an accessible fallback (a visually-hidden data table / aria-label summary) so the data is available to screen readers, not just sighted users. Colour is paired with shape/label, never used alone.
Install and import
npx shadcn@latest add @prism/cohort-grid
import { CohortGrid } from '@/components/prism/CohortGrid';
In a no-build prototype, read it from the bundle instead: const { CohortGrid } = window.PrismDesignSystem_39d121;
Props
| Prop | Type | Required | Description |
|---|---|---|---|
cohorts | Cohort[] | Yes | |
periodLabel | (index: number) => React.ReactNode | — | Column header for period index i. Default "P0", "P1", … |
periods | number | — | Force a column count. Default: the longest cohort. |
showSize | boolean | — | |
formatValue | (value: number) => React.ReactNode | — | |
cellHeight | number | — | |
caption | string | — | |
className | string | — |