Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Cohort Retention Table Stats Block for React

A triangular retention table of six weekly signup cohorts by months M0 to M5, a percent in every cell in five foreground steps, an average row at the foot and the month-one average in the header.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

A cohort retention table for React with Base UI. A start-aligned header states the month-one average, "67% of new users come back in month one". A framed table follows: six weekly signup cohorts down the side (each with its size) and six months across, M0 for the signup month to M5, with the share of the cohort still active written in every cell and shaded in five solid steps of your theme's foreground colour (the text switches to the page colour from 60 percent so it keeps its contrast). Months a cohort has not reached yet are empty outlines, so the filled cells make a triangle, and an average row at the foot gives the mean of the cohorts that have reached each month. It is a real table with a caption and row and column headings, so screen readers announce the cohort and the month for each cell. The averages and the headline are counted from one list of cohorts. On a phone M4 and M5 drop out and the cohort size moves under its name. For retention, repeat purchase and any cohort-by-period measure.

FAQ

How do I use my own cohorts?

Edit COHORTS at the top of the file: a name, the cohort's size and a kept list of percents for month 1 and on (month 0 is always 100). A newer cohort has a shorter list, which is what makes the triangle. The averages are the mean of the cohorts that have reached each month, rounded to a percent, and the headline reads month one's average.

How are the shades chosen?

A cell's step comes from its percent: under 20, 40, 60, 80, and 80 or more. They are solid mixes of the foreground colour into the card, and the text is the foreground colour up to the third step and the page colour from the fourth, so every cell keeps its contrast in light and dark. The number is always in the cell, so shade is never the only signal.

Why is it a native table?

It needs a caption, column headings and a header for each row, and a native table gives all three on every library. Cohort names are row headings, months are column headings (announced as "Month 3"), and an empty cell says "Not reached yet". The table is forced left to right so months run from the start of the line in every language.

How is the average row computed?

For each month it averages only the cohorts that have a value for it, so M5 is the oldest cohort's figure alone and M1 is the mean of five. It is a simple mean of percents, not weighted by cohort size, and the row is set apart from the cohorts with space and a bold heading.

What happens on a phone?

M4 and M5 are hidden so the remaining columns stay wide enough to read their percents at 320 pixels, and each cohort's size moves under its name. The key stays under the table. Nothing scrolls sideways; on wider screens all six months show.

  • Pro

    A butterfly funnel for a signup-analytics tool: mobile and desktop bars grow outwards from a column of stage names, with each cohort's step conversion and a column that names the stronger cohort at every stage.

  • Pro

    Six services by the last eight hourly check windows: passing cells in a foreground tone, degraded cells half filled, a failed cell outlined with a cross and the destructive dot, tooltips and an uptime column.

  • Pro

    A 26-week contribution grid of daily lessons with month labels, a Less to More key and a band of three counters for the current streak, the longest streak and the active days.

  • Pro

    A six-week calendar of square cells showing each day's date and meeting hours in five foreground steps, beside the month's total, busiest day, quietest weekdays and weekday average.

  • Pro

    A 24 by 12 traffic density grid in a framed figure with a legend, three numbered callout cells, and the callouts described beside it, for a traffic observability tool.

  • Pro

    Coverage Heatmap Team

    Skills and expertise

    A heatmap of six skills by five field-survey people, every cell a button shaded in five foreground steps with its level written in it, a target column, a coverage count with a Thin marker and a polite line that names the picked cell.