Skip to content
Charts55Components12Visuals14ASCII45
GitHubGet startedGet started
All chartsCohort retentionPatterns
PreviousNext: Scatter

PatternsPA-02

Cohort retention

How long people stay: one row per signup cohort, one column per period since, each cell the share still active.

Part
PA-02
Component
CohortRetentionCard
From
@lilt-ui/charts

Monthly retention

51.2%51.2%
M0M1M2M3M4M5M6M7SizeFeb 20261.8KMar 20262.1KApr 20262KMay 20262.5KJun 20262.7KJul 20262.4KAug 20263KSep 20263.1KAverage
Monthly retention
ObservationValue
Feb 2026 · period M0100% · 1.8K of 1.8K
Feb 2026 · period M146% · 846.4 of 1.8K
Feb 2026 · period M239.6% · 728.6 of 1.8K
Feb 2026 · period M334% · 625.6 of 1.8K
Feb 2026 · period M429.3% · 539.1 of 1.8K
Feb 2026 · period M525.2% · 463.7 of 1.8K
Feb 2026 · period M621.6% · 397.4 of 1.8K
Feb 2026 · period M718.6% · 342.2 of 1.8K
Mar 2026 · period M0100% · 2.1K of 2.1K
Mar 2026 · period M148% · 1K of 2.1K
Mar 2026 · period M241.8% · 882 of 2.1K
Mar 2026 · period M336.3% · 765.9 of 2.1K
Mar 2026 · period M431.6% · 666.8 of 2.1K
Mar 2026 · period M527.5% · 580.3 of 2.1K
Mar 2026 · period M623.9% · 504.3 of 2.1K
Apr 2026 · period M0100% · 2K of 2K
Apr 2026 · period M144% · 862.4 of 2K
Apr 2026 · period M237.4% · 733 of 2K
Apr 2026 · period M331.8% · 623.3 of 2K
Apr 2026 · period M427% · 529.2 of 2K
Apr 2026 · period M523% · 450.8 of 2K
May 2026 · period M0100% · 2.5K of 2.5K
May 2026 · period M151% · 1.3K of 2.5K
May 2026 · period M244.9% · 1.1K of 2.5K
May 2026 · period M339.5% · 979.6 of 2.5K
May 2026 · period M434.8% · 863 of 2.5K
Jun 2026 · period M0100% · 2.7K of 2.7K
Jun 2026 · period M153% · 1.4K of 2.7K
Jun 2026 · period M246.6% · 1.3K of 2.7K
Jun 2026 · period M341% · 1.1K of 2.7K
Jul 2026 · period M0100% · 2.4K of 2.4K
Jul 2026 · period M155% · 1.3K of 2.4K
Jul 2026 · period M249% · 1.2K of 2.4K
Aug 2026 · period M0100% · 3K of 3K
Aug 2026 · period M157% · 1.7K of 3K
Sep 2026 · period M0100% · 3.1K of 3.1K
Average · period M0100% · weighted by size, 8 cohorts
Average · period M151.2% · weighted by size, 7 cohorts
Average · period M243.7% · weighted by size, 6 cohorts
Average · period M337% · weighted by size, 5 cohorts
Average · period M431% · weighted by size, 4 cohorts
Average · period M525.3% · weighted by size, 3 cohorts
Average · period M622.8% · weighted by size, 2 cohorts
Average · period M718.6% · weighted by size, 1 cohort
Default01 / 02

Installation

One package, one sheet.

Add the package, then import the component and the stylesheet once. See Getting started for theming.

$npm install @lilt-ui/charts
import { CohortRetentionCard } from '@lilt-ui/charts';
import '@lilt-ui/charts/styles.css';

Usage

The default card.

The default card above, as you would write it.

<CohortRetentionCard
  title="Monthly retention"
  data={cohorts}
  cohort="cohort"
  periods={['m0', 'm1', 'm2', 'm3']}
  size="users"
/>

Omit title to leave out the visible title. Set header={false} to remove the whole header, and use aria-label to name a chart inside your own card. surface="ghost" controls only the visual frame. See Card composition.

Data

The shape it reads.

Later cohorts have lived through fewer periods, so their missing cells are left out and the grid steps down like a staircase. The average row weights each cohort by its size when size is given, and counts only cohorts that reached that period. Values must be shares from 0 to 1; anything else is an error rather than a misleading cell. Cohort names must be unique and keep your order.

// One row per cohort. Each period is the share still active, from 0 to 1;
// null is a period the cohort has not reached yet.
const cohorts = [
  { cohort: 'Feb 2026', users: 1840, m0: 1, m1: 0.46, m2: 0.4, m3: 0.34 },
  { cohort: 'Aug 2026', users: 2950, m0: 1, m1: 0.57, m2: null, m3: null },
];

Props35

Every prop.

Every prop CohortRetentionCard accepts, in the order you are likely to reach for them.

PropTypeDescription
cohorttext key of RowEach cohort’s name.
periodsnumeric key of Row[]One field per period since the cohort started, each a share from 0 to 1.
periodLabelsstring[]Column headings. Defaults to 0, 1, 2…
sizenumeric key of RowStarting size: shown beside the name and used to weight the average.
averagebooleanAdd an average row under the cohorts. Defaults to true.
headlinePeriodkey of periodsThe period whose average is the headline. Defaults to the second.
titlestringOptional visible title. Omit to render no title. Also supplies the accessible name unless aria-label is set.
headerbooleanDefaults to true. False removes the whole header: title, headline, delta and period controls, with no reserved space. Pass data directly when your app owns period selection.
aria-labelstringAccessible chart name, independent of the visible title. Falls back to title, then a generic chart name.
dataRow[]One row per observation. Omit when using ranges.
heightnumberMinimum plot height, default 260. Dense lanes expand to keep every mark visible.
depthbooleanLit tiles, solid bars, or spheres. Data positions remain exact; loading keeps the same depth treatment.
colorstringOverride the palette with one CSS color.
headlinenumberOverride the resting headline.
deltanumberFractional change shown alongside the headline.
deltaTone'default' | 'inverse' | 'neutral'Use inverse when a decrease is good.
rangestringStatic period label.
ranges{ id, label, data, headline?, delta? }[]Period choices with their own data.
defaultRangestringInitial period id.
localestringLocale for numbers and dates; defaults to en-US.
formatValue(value: number) => stringCustom value formatter.
badgeReactNodeContent for the glass tab above the card.
classNamestringClass on the card frame.
styleCSSProperties | ChartStyleInline styles and scoped chart variables.
onSelectionChange(selection | null) => voidReports id, original row (or null for an absent day), value, and pinned state.
renderReadout(selection | null) => ReactNodeConsumer-owned readout, including when the header is hidden.
valueFormatIntl.NumberFormatOptionsFormats the headline, tiles, and axis, e.g. currency.
surface'elevated' | 'outline' | 'ghost'Card treatment. Ghost removes the visual frame only; header and legend are independent controls.
palette'spectrum' | 'iris' | 'cobalt' | 'emerald'Series colors. Spectrum by default; explicit series colors still win.
numberStyle'count' | 'pop' | 'slide' | 'roll' | 'flow' | 'scramble'How the headline animates when its value changes. Count (default) counts to the new value.
loadingbooleanShows a neutral loading skeleton, not data.
loadingStyle'shimmer' | 'draw' | 'breathe'Shimmer sweeps a highlight over still shapes; draw reveals them in order; breathe lets them settle. Follows the selected look, including depth, and respects reduced motion.
empty'dots' | 'shape' | ReactElement | nullWhat the card shows when the period has no data. Dots (default) gathers a quiet dot field around the message; shape lays the chart’s own outline behind it. Pass `<ChartEmpty>` with your own words, any element of your own, or null for nothing. Both looks stay still, so empty never reads as loading, and the headline reads a dash, never zero.
motion'auto' | 'none'None turns off decorative motion; reduced motion does this automatically.
onKeyDownKeyboardEventHandler<HTMLElement>Keyboard handler on the card frame. Chart inspection also has its own keyboard handling.
Previous chartHeatmapNext chartScatter

Ready when your data is. Start with one install.

Install a package, import the stylesheet once, and drop in a card or a scene.

Read the guideRead the guideView on GitHubView on GitHub
ChartsAll chartsAll chartsFinanceFinanceCustomizeCustomizeFeaturesFeatures
ComponentsAll componentsAll componentsAIAIStatusStatusActionsActionsDataData
VisualsAll visualsAll visualsAIAIDataDataSecuritySecurityProductProduct
ASCIIAll scenesAll scenesTextTextInterfaceInterfaceBackgroundsBackgroundsMediaMediaDataData
DocsGetting startedGetting startedAPI referenceAPI referenceMotion & accessibilityMotion & accessibilityllms.txtllms.txt
React components with a little lilt.GitHubGitHubnpmnpm