本文へ移動
日本語
「ファネルチャート」は Pro に含まれます。解除するとプレビューが表示されます。

仕組み

Hand-written SVG laid out in real pixels. Each step is a rounded block; behind it a hatched block reaches up to the height of the step before, so the drop-off reads as a shape rather than a number. Blocks slide up out of a clip at the baseline (translateY, so the rounded tops keep their shape). Chips are HTML placed above each block and count with JavaScript; the selection only changes colour. New data moves every block from its old height through CSS geometry transitions.

向いている場面

  • A short ordered flow where people drop off: visit, view, cart, pay; sign up, verify, first project.
  • A dashboard tile that answers "how many made it to the end" and "where did we lose them".
  • Comparing the same funnel between two periods by switching data.

向かない場面

  • Steps that are not a strict sequence, or people who can skip steps: use bars.
  • More than five or six steps: blocks get too narrow for their chips; use a table or a full funnel report.
  • Change of one step over time: use a line chart.

使い方

import { FunnelChart } from './FunnelChart.jsx'

export function StoreFunnel() {
  return (
    <FunnelChart
      title="Store funnel"
      subtitle="This week"
      onOpen={() => {}}
      stages={[
        { name: 'Visits', value: 12480 },
        { name: 'Product', value: 7215 },
        { name: 'Cart', value: 2306 },
        { name: 'Paid', value: 864 },
      ]}
      color={8}
    />
  )
}

プロパティ

プロパティ型既定値説明
stages{ name: string, value: number, color?: number | string }[]—Steps from first to last. Three to five fit a card. color overrides the card colour for one step.
title / subtitle / iconReactNode—Card header: a tinted icon tile, a 15px title and a quieter subtitle after it.
onOpen / action() => void / ReactNode—onOpen adds a chevron button at the end of the header. action replaces it with any node.
value / unitnumber | string / string—Hero. By default it is the conversion from the first step to the selected one, formatted with formatPercent; a number you pass is formatted with formatValue.
captionstring | (first: string, step: string, index: number) => string—Line above the hero. By default "Visits to Paid", following the selection.
delta{ value: number, label?: string, positive?: 'up' | 'down', format?: (n) => string }—Change badge after the hero, such as the change against last week.
selected / onSelectnumber / (index: number) => void—The step at rest, drawn solid. Defaults to the last one; a click or Enter pins another.
colornumber | string1Block colour: 1–8 for --ds-chart-N (soft at rest, solid when selected), or a CSS colour.
heightnumber128Plot height in px. Each step keeps at least 18px so a tiny last step stays visible.
showRatebooleantrueConversion chips above each step after the first. The chip into the selected step is ink.
formatValue / formatPercent(n: number) => string(n) => n.toLocaleString('en-US') / 12% or 4.5%Formats for step values and for percentages (chips, hero, screen-reader text).
labelstring—Accessible name of the funnel and caption of the hidden table. Defaults to the title.
labelsobject—Replaces built-in text: open, chart(name, count), caption(first, step), step(name, value, ofFirst, fromPrevious), dataTitle, stage, value, conversion, share.
replayKeystring | number—Change it to play the entrance again. Renaming steps also replays it; changing only values glides.
className / style / ...restHTMLAttributes—Passed to the card root, which fills its container width.

アクセシビリティ

  • The funnel is a focusable group named after the chart. Left and Right move between steps, Home and End jump to the ends, Enter pins a step and Escape goes back to it.
  • Each move is announced through a polite live region with the value, share of the first step and conversion from the previous one.
  • A visually hidden table lists every step; the drawing is hidden from screen readers.
  • Step names and values are real text under the blocks; the selected chip differs by fill and text colour, not hue alone.
  • Reduced motion shows the final funnel at once and the numbers do not count.

モーション

Entrance waits until 30% of the card is visible. Blocks slide up over 900ms on cubic-bezier(0.22, 1, 0.36, 1), 70ms apart; hatched drop-offs fade in from 320ms; chips pop on a spring from 380ms, 90ms apart, and count up with the hero; names rise from 160ms. Moving the selection recolours in 160ms and counts in 380ms; new data glides over 900ms.

プロジェクトに追加

Pro メンバーはプロンプトをコピーし、コーディングエージェントが無料コンポーネントと同じ手順でソースを導入します。

FunnelChart.jsxfunnel-chart.csstokens.cssREADME.md

2 つのファイルを一緒に導入します。スタイルは tokens.css の変数を読み、予備の値も持つため、単体でも表示できます。

グラフ
「三辺測位」は Pro に含まれます。解除するとプレビューが表示されます。