Examples
Funnel chart Pro
The stages people drop out of, top to bottom: visits, sign-ups, trials, paid. Each bar is as wide as its count, joined to the next by a faint connector, with the count and its share of the first stage (or the step before, with percentOf="previous") beside it. Screen readers hear each step's conversion and the overall one.
import { FunnelChart } from '@patine-ui/pro';
Live data
Loading…
<View style={{ width: '100%', maxWidth: 380, gap: 8 }}> <View style={{ flexDirection: 'row', gap: 8, justifyContent: 'flex-end' }}> <Button size="sm" variant="outline" onPress={() => setStep((s) => !s)}>{step ? 'Of first' : 'Of previous'}</Button> <Button size="sm" variant="outline" onPress={() => setData(roll())}>Shuffle</Button> </View> <FunnelChart data={data} nameKey="stage" valueKey="people" percentOf={step ? 'previous' : 'first'} accessibilityLabel="Sign-up funnel, this week" /> </View>
Try the props
percentOfdesign<FunnelChart data={funnel} nameKey="stage" valueKey="people" />
Example: a checkout funnel
A shop's checkout, step by step: switch between phones and computers to see where each loses people. Shown against the previous step, the biggest drop stands out.
Loading…
<View style={{ width: '100%', maxWidth: 560, gap: 12 }}> <SegmentedControl items={[{ label: 'Phones', value: 'phone' }, { label: 'Computers', value: 'computer' }]} value={device} onValueChange={setDevice} style={{ alignSelf: 'flex-start' }} /> <FunnelChart data={data} nameKey="step" valueKey="people" percentOf="previous" accessibilityLabel={`Checkout funnel on ${device}s`} /> <Text size="sm" color="textSecondary">{rate}% of visitors paid</Text> </View>
Props
The shared chart props except the legend, and:
| Prop | Type | Default | Description |
|---|---|---|---|
nameKey | string | — | The row field naming each stage, top to bottom. |
valueKey | string | — | How many reached it. |
series | { key, label?, color? }[] | — | Labels and colors for stages. |
percentOf | 'first' | 'previous' | 'first' | Each stage's share of the first stage or the one before. |
colorful | boolean | false | A palette color per stage instead of one color. |
height | number | 52 per stage |