How many make it through each step, and where they drop off.
- Visited pricing48,210
- Started a trial6,90414% of Visited pricing, 14% of the step before
- Invited a teammate2,8716% of Visited pricing, 42% of the step before
- Connected a repository1,9664.1% of Visited pricing, 68% of the step before
- Upgraded to paid7421.5% of Visited pricing, 38% of the step before
import type { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Funnel } from "./ui/uicontext/components/charts/Funnel.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { trialFunnel } from "./metrics.ts"const styles = stylex.create({ frame: { inlineSize: "100%" } })// From the pricing page to a paid plan in the last 30 days: each step's share of everyone who// started, and how many dropped between steps.export const TrialFunnel = <M>(h: Html.H<M>) => h.div.attrs(sx(styles.frame)).children(Funnel(h, { label: "Trial to paid, last 30 days", steps: trialFunnel }))Installation
pnpm dlx shadcn@latest add checkfu/uicontext/funnelUsage
import type { ChartDatum } from "./ui/uicontext/components/charts/Data.ts"import { Funnel } from "./ui/uicontext/components/charts/Funnel.ts"export const TrialFunnel = <M>(h: Html.H<M>, steps: ReadonlyArray<ChartDatum>) => Funnel(h, { label: "Trial to paid, last 30 days", steps })Examples
Pick a step
Steps as buttons, to filter a report.
- , 14% of the step before
- , 42% of the step before
- , 68% of the step before
- , 38% of the step before
Pick a step to see who stopped there.
import { UiSchema } from "@effect/ui"import { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Schema } from "effect"import { Funnel } from "./ui/uicontext/components/charts/Funnel.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { color, font, space } from "./ui/uicontext/components/tokens.stylex.ts"import { trialFunnel } from "./metrics.ts"const styles = stylex.create({ root: { display: "grid", gap: space.md, inlineSize: "100%" }, note: { margin: 0, color: color.muted, fontSize: font.sm },})const Message = UiSchema.TaggedEnum({ PickedFunnelStep: { id: Schema.String } })// Each step is a button: pick one to list the people who stopped there.export const SelectableFunnel = Html.component({ name: "SelectableFunnel", model: Schema.Struct({ step: Schema.NullOr(Schema.String) }), message: Message,}).make({ init: () => ({ step: null }), update: { PickedFunnelStep: ($, { id }) => $.evolve({ step: (step) => (step === id ? null : id) }) }, view: (h, model) => h.div.attrs(sx(styles.root)).children( Funnel(h, { label: "Trial to paid, last 30 days", steps: trialFunnel, selected: model.step ?? undefined, select: (id) => Message.PickedFunnelStep({ id }), color: 7 }), h.p.attrs({ role: "status", ...sx(styles.note) }).children( model.step === null ? "Pick a step to see who stopped there." : `Showing people who reached “${trialFunnel.find((s) => s.id === model.step)?.label ?? ""}” and went no further.`, ), ),})API reference
Options
| Name | Type | Description |
|---|---|---|
labelrequired | string | — |
stepsrequired | ChartDatum[] | — |
format | ChartFormat | — |
color | ChartColor | — |
selected | string | The step that's picked, drawn as pressed |
select | ((id: string) => Message) | Makes each step a button that sends this |
locale | string | — |
style | Style | — |
Accessibility
- An ordered list: each step reads its count, its share of the first step and of the step before.
- When steps can be picked they're toggle buttons (
aria-pressed).