Cohort Heatmap is an analytics widget that renders a two-dimensional grid where rows represent user cohorts (grouped by signup period) and columns represent time periods after signup. Each cell is color-coded by intensity to show retention or engagement rates. The widget builds on the existing HeatStrip cell-rendering pattern and extends it into a full grid with row/column headers, a color legend, and an accessible summary.
Goals
Deliver a <CohortHeatmap> component that renders a grid of color-intensity cells with row and column headers.
Use design-system color tokens for cell tones with configurable intensity mapping.
Include a legend explaining the color scale.
Provide an accessible summary table for screen readers.
Ship Storybook stories with realistic cohort retention data.
Non-Goals
Interactive cell selection or drill-down to user lists.
Editable cells or inline data entry.
Server-side cohort calculation or query integration.
Pivot-table or sortable-column behavior (that is DataGrid territory).
Scope
In Scope
Area
Description
Component
<CohortHeatmap> rendering a color-coded grid of cohort data
Cell Rendering
Each cell shows a background color based on intensity (0-1) and optional text value
Headers
Row headers for cohort names, column headers for time periods
Legend
Color scale legend mapping intensity values to colors
Accessible Summary
Visually-hidden table with full data for screen readers
States
Loading skeleton, empty state, error state
Stories
Storybook stories for retention, engagement, and edge cases
Out of Scope
Area
Reason
Sortable columns
DataGrid concern; heatmap is read-only visualization
Cell editing
Heatmap is a display-only widget
Custom cell renderers
Cells show color + optional value text; complex renderers deferred
Cohort calculation logic
Consumer provides pre-calculated data
Users and Pain Points
User Groups
User
Description
Needs
Developers
Engineers building retention dashboards
A token-aligned cohort heatmap component
Growth PMs
Product managers tracking cohort behavior
Visual cohort retention grid with clear drop-off patterns
Data Analysts
Dashboard consumers
Quick scan of cohort trends via color intensity
Pain Points
User
Pain Point
Impact
Developers
Building cohort heatmaps from scratch requires custom grid layout, color interpolation, and accessibility work
High development cost, inconsistent results
Growth PMs
Existing tables show raw numbers without visual intensity cues
Slower pattern recognition
Definitions
Term
Definition
Cohort
A group of users who share a common characteristic, typically signup date range
Intensity
A normalized value (0 to 1) representing the metric strength for a cell
Retention Rate
The percentage of a cohort still active after N time periods
Color Scale
A gradient mapping intensity values to background colors using design tokens
Current State
Existing Behavior
HeatStrip renders a single-row heatmap with intensity-based cell coloring. It uses a single color with opacity scaling (0.2 to 1.0) based on intensity. There is no multi-row grid heatmap component.
Current Limitations
HeatStrip is single-row only; no grid layout support.
No row/column header support.
No color legend component.
No accessible summary for multi-dimensional data.
Existing Workarounds
Teams use raw HTML tables with inline background-color styles.
Some teams use third-party heatmap libraries that do not align with DS tokens.
Proposed Solution
Summary
Introduce <CohortHeatmap> that accepts rows (cohort data with cell intensities), columnHeaders, and color configuration. The component renders a grid using the HeatStrip cell-rendering pattern (color + opacity scaling) extended to a 2D layout. A legend renders below the grid showing the color scale.
Key Capabilities
Two-dimensional grid with cohort rows and time-period columns.
Cell coloring via design-system color tokens with intensity-based opacity.
Optional text value overlay on cells (e.g., “45%”).
Color scale legend with min/max labels.
Visually-hidden data table for screen reader accessibility.
Sticky row headers for horizontal scrolling on wide grids.
User Experience
Users see a grid where the top-left cell is empty, the first row contains time-period headers (Week 1, Week 2, etc.), and each subsequent row is a cohort. Cells are colored from light (low intensity) to saturated (high intensity). Hovering a cell shows a tooltip with the exact value. A legend below explains the color scale.