Funnel

Conversion through ordered stages, with both the overall rate and the step rate. A funnel showing only the overall rate hides which single step is losing people.

src/components/ui/funnel.tsx

About

From the component's own source, where it was written.

Conversion through ordered stages.

Two rates per stage, and the distinction matters more than the picture: *overall* is against the first stage, *step* is against the one immediately before. A funnel showing only the overall rate hides which single step is losing people, which is the entire question a funnel is built to answer.

Bar width is proportional to the count rather than to the step rate, so the shape reflects volume. A stage keeping 90% of a tiny cohort should not look wider than one keeping 40% of everyone.

Install

npx astralyx-ui add funnel

Usage

import { Funnel } from '@/components/ui/funnel'

<Funnel stages={stages} />

Composer

Change the props and the source below follows.

  1. Visited pricing12,480100%
  2. Started trial3,12025%

    25% from previous · 9,360 dropped

  3. Invited a teammate1,49012%

    48% from previous · 1,630 dropped

  4. Converted6205%

    42% from previous · 870 dropped

Props
tsx
<Funnel stages={stages} showStepRate={true} />

Examples

Signup funnel

API

Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.

Funnel

Conversion through ordered stages.

Extends Omit<ComponentProps<'ol'>, 'children'>.

PropTypeDefaultDescription
colorstring'var(--blue)'—
stagesFunnelStage[]required{ label, value, hint? }, in order.
showStepRatebooleantrueAdds the rate against the previous stage and how many dropped.
format(value: number) => stringDEFAULT_FORMAT—
widthvolume—Proportional to the count, not the step rate — a stage keeping 90% of a tiny cohort should not look wider than one keeping 40% of everyone.

Types

FunnelStage

FieldTypeDescription
labelReactNode—
valuenumber—
hint?ReactNode—