shadcn.io is not affiliated with official shadcn/ui
Split Cohorts Funnel Stats Block for React
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.
Installation
Overview
A split-cohort funnel for React with Base UI. A start-aligned header says how much better one device converts, "Desktop converts 3.2× better than mobile", and a band of five stage rows runs from rail to rail and ends the block. On a wide screen each row reads outwards from the stage name in the middle: the mobile bar grows to the start, the desktop bar to the end, each with its step conversion (the share of the stage before that got there) and its count beside it, and a last column names the stronger cohort at that stage with an arrow towards it and the gap in points. Both bars are a share of their own cohort's first stage, so the two funnels start at the same width and the butterfly shows where they part. On a phone each stage is a pair of bars stacked under its name, with a label and numbers above each. The bars, conversions, gaps and headline are all computed from the counts, in CSS bars with no chart library. For signup, onboarding and checkout funnels compared across two segments: devices, plans, channels.
FAQ
How do I change the stages and the cohorts?
Edit STAGES, MOBILE and DESKTOP at the top of the file: the stage names, and the number of people who reached each stage in each cohort. The widths, step conversions, the stronger cohort and the gap at each stage, the end-to-end rates and the ratio in the headline are all computed from the counts. To compare other segments rename the cohort labels (they appear in the column heads, the numbers, the arrows and the screen-reader text) and keep two cohorts; the layout is drawn for two.
What does a bar's width mean?
The share of that cohort's own first stage that reached the stage: the mobile bar at "Created a workspace" is 19% of mobile visitors, the desktop bar 30% of desktop visitors. That is why both top bars are full width and the funnels can be compared by shape, even though one cohort is much bigger. The big figure beside each bar is a different number: the step conversion, the share of the stage before.
How is the stronger cohort chosen?
By comparing the two whole-percent step conversions at the stage: whichever is higher is the stronger, and the gap is the difference in points. The first stage has no step, so its cell is a dash, and a tie shows a dash too. The cell is a quiet pill with the cohort's name, the gap and an arrow towards that side of the funnel, in the text colour: it says which cohort did better, not whether that is good news.
Is the funnel accessible?
Each stage is a list item with an h3 and a description list: for each cohort, its step conversion and its count, then the stronger cohort and the gap, in reading order. The bars are decorative because the numbers beside them say the same. The two cohorts differ by position and by weight (full strength and 45%) and are named in the column heads and, on a phone, above each pair of bars, so colour is never the only cue.
Does it work in right-to-left languages?
The band is a left-to-right box in every language, because it is a drawing with a fixed meaning (mobile at the start of the line, desktop at the end), and the arrows point at the real side of the chart. The header above it follows the page direction, and the numbers and percents sit in bdi elements.
How does it fit on a phone?
Below lg the six columns become a single one: the stage name and the stronger cohort share the first line, then one line and one full-width bar for each cohort. Nothing scrolls sideways at 320 pixels. The bars grow in once on a wide screen only, so a phone shows them settled.
Related
- Pro
Vertical Stages Funnel Stats
FunnelsA checkout funnel as five left-anchored bars with a connector row between each that says how many were lost, beside the overall conversion as a big number and the stage that leaks the most.
- Pro
Dropoff Rate Funnel Stats
FunnelsA leak-first funnel for an onboarding tool: five steps, each a solid bar of who got that far followed by a hatched ghost of who was lost, the drop rate as the big figure, and the biggest leak ringed with a badge.
- Pro
Stage Icons Funnel Stats
FunnelsA column funnel for a signup-flow analyser: five columns shrinking from the start to the end on a baseline, an icon plate under each as the step's node, and the share that made it across between two nodes.
- Pro
Revenue Funnel Stats
FunnelsA funnel as a real table for a sales team's pipeline: stage, deals, step conversion and value, each number with a thin bar to the scale of its column, and the overall conversion rolling in the header.
- Pro
Diverging Bar Chart Stats
Bar and columnTwelve monthly returns as bars above and below a labelled zero line: gains solid, losses outlined, every value at its tip with a sign, and no green or red.
- Pro
Grouped Bar Chart Stats
Bar and columnTwo bars per month, this year solid and last year lighter, with a Chart and Table switch that swaps the drawing for a real table of the same numbers in the same box.