Skip to content
WunderUI

River Chart

Pro

River chart (streamgraph) for how a mix changes over time: plain, with gradient bands or offset.

Playground

Tickets by topic

River chart, 12 points from Jan to Dec. Billing from 110 to 91, lowest 69, highest 173; Access from 114 to 59, lowest 54, highest 123; Bugs from 62 to 180, lowest 62, highest 180; API from 86 to 90, lowest 39, highest 97; Other from 64 to 78, lowest 61, highest 79.
Support tickets by topic, data table
monthBillingAccessBugsAPIOther
Jan110114628664
Feb140119679672
Mar151123978379
Apr17399937573
May1521001136169
Jun152931255570
Jul124691243969
Aug100781355575
Sep79631326267
Oct80611437561
Nov69541629766
Dec91591809078

Installation

River Chart comes with WunderUI Core and Pro, in the package from your plan. See the plans.

The charts live in their own entry point: import the chart, its card and its hooks from @wunderui/react/charts, not from @wunderui/react.

Then import what you need:

tsx
import {
  RiverChart,
  RiverChartProps,
  RiverChartVariant,
} from "@wunderui/react/charts"

Then use it:

tsx
import { RiverChart } from "@wunderui/react/charts"

const data = [
  { month: "Jan", billing: 128, access: 94 },
  { month: "Feb", billing: 142, access: 88 },
  { month: "Mar", billing: 151, access: 81 },
  { month: "Apr", billing: 139, access: 79 },
]

export function TicketsByTopic() {
  return (
    <RiverChart
      data={data}
      index="month"
      series={[
        { key: "billing", label: "Billing" },
        { key: "access", label: "Access" },
      ]}
      label="Support tickets by topic"
    />
  )
}

Expected result: You should see two smooth bands flowing around a centre line, with the months below and no value axis.

When to use

Use River Chart for

  • How a mix changes over time, where the thickness of a band is the message
  • Topics, categories or channels that rise and fall around a centre line

Use something else for

States

Loading, empty and error keep the chart's size, so the card never jumps. Add a retry handler and the error state offers a Try again button.

Tickets by topic

River chart, 12 points from Jan to Dec. Billing from 110 to 91, lowest 69, highest 173; Access from 114 to 59, lowest 54, highest 123; Bugs from 62 to 180, lowest 62, highest 180; API from 86 to 90, lowest 39, highest 97; Other from 64 to 78, lowest 61, highest 79.
Support tickets by topic, data table
monthBillingAccessBugsAPIOther
Jan110114628664
Feb140119679672
Mar151123978379
Apr17399937573
May1521001136169
Jun152931255570
Jul124691243969
Aug100781355575
Sep79631326267
Oct80611437561
Nov69541629766
Dec91591809078

Keyboard interactions

The plot is focusable: Arrow keys walk the time steps and the live region announces each series at that step.

TaborShiftTab
Moves focus to the plot and away from it. The plot is one tab stop; so is every legend badge.
ArrowRightorArrowLeft
Moves to the next or previous time step. The tooltip follows, and a live region announces the one you are on. The first press starts at the first one (Left: the last one).
HomeorEnd
Jumps to the first or last time step.
Escape
Clears the active point.
EnterorSpace
On a legend badge of a ChartCard: switches its series off or on. The last visible series stays on.

Behavior and motion

What the chart does on its own and what the page decides.

Values
Values must be zero or positive; a missing value counts as zero. The layers are ordered inside out, so the largest bands sit near the centre.
No value axis
The value axis and grid are off by default, because only the thickness of a band means something. The category axis runs below, and options bring the others back.
Offset
The offset variant moves each band apart by a small gap and keeps the whole river centred, and the gradient variant draws the bands with a gradient.
Loading, empty and error
The chart keeps its size while loading, empty or failed, so the card never changes height. Add a retry handler to show a Try again button on error.
Legend
In a ChartCard, each series badge is a button that switches its series off, but the last visible series stays on. A legend of roles can be made static.
Data table
The chart renders its data as a table for screen readers, in the same order as the plot.
Size
The chart fills the width of its container and you set the plot height. Text never scales, so labels keep their size at every width.

Motion

The enter sequence and the hover follow the motion tokens of the library.

Wipe
Each band is wiped in from left to right when the chart first comes into view, after loading and when new data arrives. The animation can be turned off.
Reduced motion
With reduced motion on, the chart appears at once without the enter sequence. The tooltip and every state still work.

Anatomy

RiverChart is a streamgraph: series flow around a centre line instead of stacking on a baseline, so the changing mix over time stands out. Variants add gradient bands or gaps between them.

Tickets by topic

River chart, 6 points from Jan to Jun. Billing from 128 to 118, lowest 118, highest 151; Access from 94 to 97, lowest 79, highest 97; Bugs from 72 to 121, lowest 72, highest 121; API from 58 to 68, lowest 55, highest 74; Other from 66 to 58, lowest 58, highest 72.
Support tickets by topic, data table
monthBillingAccessBugsAPIOther
Jan12894725866
Feb14288806661
Mar15181917472
Apr13979996264
May122861125569
Jun118971216858
  • Pass data with the index field and the series. Values must be zero or positive, and a missing value counts as zero; the largest bands sit near the centre.

  • data-slot="chart-plot"

    The focusable region. Arrow keys walk the time steps and announce each series at that step.

  • data-slot="chart-axis-x"

    The value axis and grid are off by default, because only the thickness of a band means something. The category axis runs below, and options bring the others back.

  • data-slot="chart-marks"

    One smooth band per series, wiped in from left to right. The offset variant moves each band apart by a small gap and keeps the whole river centred.

  • data-slot="chart-tooltip"Optional

    The time step with the value of each visible series.

  • data-slot="chart-message"Optional

    A muted area under the shimmer. A retry handler adds a Try again button to the error message.

  • The raw values per series and step for screen readers.

Best practices

  • Do

    Keep to four to seven series with a clear name each, and put the legend in the ChartCard. Bands are labelled only through colour and the tooltip.

  • Do

    Use at least a dozen time steps. With only a few points the smooth bands exaggerate movement that the data does not contain.

  • Do

    Describe the reading in the description, for example Band thickness is the monthly sessions per channel, because the chart has no value axis by default.

  • Don’t

    Don't use it to read exact totals. Thickness is hard to compare between steps; if a number matters, use StackedChart and its labels.

  • Don’t

    Don't pass negative values. Bands cannot be negative and the chart treats them as zero.

API reference

One table for RiverChart, listing every prop. A ChartCard around it takes its own props, and the chart works without one.

Pass data with the index field and the series. Values must be zero or positive, and a missing value counts as zero; the largest bands sit near the centre.

PropTypeDefaultDescription
data requiredreadonly ChartDatum[]—One object per category / point.
index requiredstring—Field holding the category label (x axis; y axis for horizontal bars).
series requiredreadonly ChartSeries[]—The series to draw, in order.
variant"basic-river" | "gradient-river" | "offset-river""basic-river"Figma variant. Default .
valueFormatterChartValueFormatter—Values in tooltip, labels, table and live region. Default: 42000 → "42k".
valueAxisboolean—Value-axis labels (default true). Off for compact cards and sparkline-like plots.
gridboolean—Grid lines (default true).
labelstring—Accessible name, e.g. the card title.
heightnumber—Height of the plot frame in px. Default 434 = the plot of the Figma large card.
state"ready" | "loading" | "empty" | "error"— shows the chart-shaped skeleton, and a message in the plot.
hiddenSeriesreadonly string[]—Series keys that are switched off (legend toggle): drawn faded, dimmed in the tooltip.
activeIndexnumber | null—The active point (hovered or focused) as an index into , to control it yourself. shows none.
animateboolean—Enter sequence (draw, wipe, grow) on scroll into view, after loading and on new data. Default true; off with reduced motion.
animationKeystring | number—Change it to play the enter sequence again (e.g. ). New replays it by itself.
axisFormatterChartValueFormatter—Value-axis labels; defaults to .
categoryAxisboolean—Category-axis labels (default true).
categoryFormatter(label) => string—Shortens category labels on the axis, e.g. "Mar 12" → "Mar"; tooltip and pill keep the full label.
categoryTicksreadonly string[]—Only these category labels are shown on the axis (the rest stay hoverable).
defaultActiveIndexnumber | null—The point that is active at first, for an uncontrolled chart. It shows the tooltip without a pointer.
defaultSelectedRangeChartRange | null—The range that is selected at first, for an uncontrolled chart.
descriptionstring—Screen-reader summary; generated from the data when omitted.
emptyDescriptionstring—Text under the title in the empty state.
emptyTitlestring—Title of the message in the empty state.
errorDescriptionstring—Text under the title in the error state.
errorTitlestring—Title of the message in the error state.
gridIntervalsnumber—Number of equal grid intervals (default 6 = 7 grid lines like the Figma cards).
gridStyle"solid" | "dashed"— draws the grid lines 4 / 4 dashed (dense dashboards).
includeZeroboolean—The value axis starts at 0 (owner rule, default). fits the data (prices, temperatures).
onActiveIndexChange(index) => void—Called with the index when the pointer or the arrow keys move to another point, and with when they leave. Use it to show the hovered value in a headline.
onRetry() => void—Shows a Try again button in the error state and calls this when it is pressed.
onSelectedRangeChange(range) => void—Called when a drag across the plot or Shift with an arrow key changes the range, and with when Escape or a click clears it.
rangeSelectableboolean—Allow selecting a range by dragging or Shift + arrow keys. On when is set.
selectedRangeChartRange | null—The selected range as inclusive indices into , to control it yourself. selects nothing.
tooltipboolean—Tooltip on hover / keyboard focus. Default true.
tooltipTitle(datum, index) => ReactNode—Title line of the tooltip; defaults to the category label.
valueAxisSide"left" | "right"—Side of the value axis (vertical charts). is the price axis of trading charts.
valueDomainreadonly [number, number]—Fix the value domain instead of fitting it to the data (still rounded to nice steps).
valueTicksreadonly number[]—Exact value-axis ticks (ascending), e.g. [0, 10000, … 70000]; replaces the nice-step domain.
widthnumber—Fixed width instead of filling and measuring the container.

Notes for AI

Give your coding assistant the Markdown reference instead of screenshots.

MCPget_component("river-chart")
InstallIncluded in Core and Pro

The full library index for assistants is at /llms.txt.