Skip to main content

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 bar
Live demo
Open ↗

When 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​

PropTypeRequiredDescription
cohortsCohort[]Yes
periodLabel(index: number) => React.ReactNode—Column header for period index i. Default "P0", "P1", …
periodsnumber—Force a column count. Default: the longest cohort.
showSizeboolean—
formatValue(value: number) => React.ReactNode—
cellHeightnumber—
captionstring—
classNamestring—