Skip to content

Range Area Chart for React

A React range area chart draws a line inside a min-max band, such as a forecast and its confidence interval. Pass data as readonly ChartRow[]: one row per x value.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/range-area-chart.json

Revenue forecast

Use left and right arrow keys to read values.

  • RangeAreaChart
  • RangeAreaTable
  • rangeAreaLegend
  • defaultRangeAreaChartLabels
  • +2 more

Forecast with a confidence band

forecastFrom marks where actuals end: the line turns dashed, the region is tinted and tagged, and the band opens out from the last actual. The plot wipes in left to right; the band breathes open from its line.

Revenue forecast

Monthly, US$ thousands. Actuals to August.

  • Revenue
  • 80% interval

Files to copy

11 folders · 25 files · 4 packages
From theme/src/
  • components/charts/{range-area-chart.tsx, chart-export-menu.tsx, chart-export.ts, chart-figure.tsx, chart-fit.tsx, chart-icons.tsx, chart-parts.tsx, chart-patterns.tsx, chart-utils.ts}
  • components/charts/chart-parts/
  • components/drawer/parts/sheet.tsx
  • components/kbd/
  • components/menu/
  • components/skeleton/
  • components/status-icons/
  • hooks/{use-controllable.ts, use-intersection.ts, use-latest.ts, use-media-query.ts, use-preferences.ts}
  • motion/tokens.ts
  • lib/{cn.ts, csv.ts, form.ts, glide-highlight.tsx, heading.ts, math.ts, popup-a11y.ts, popup-motion.ts, warn-once.ts}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/range-area-chart.jsonRegistry item: range-area-chart. The styles need the Tailwind v4 glass UI setup.
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

Next.js: samples here pass functions (formatters, seriesLegend, a dashboard's load), so put them in a file that starts with "use client".

Two series with bands

Overlapping bands stay light (14%) so both remain readable, and every band is drawn before any line. Switch the month: lines and bands morph to the new values.

Daily temperature

First two weeks of July, °C

  • Lisbon
  • Lisbon low–high
  • Oslo
  • Oslo low–high

Props

PropTypeDefaultDescription
data (required)readonly ChartRow[]NoneOne row per x value. Leave a value out (or null) to break the line or band there.
index (required)stringNoneKey of the x value in each row (e.g. "month").
series (required)readonly RangeSeries[]None1–3 lines, each with its band. Give each a fixed color slot.
curve"linear" | "monotone""monotone""monotone" draws smooth curves that never overshoot a value; "linear" joins points with straight lines.
forecastFromstringNoneThe x value (e.g. "Jul") where the forecast starts: from there the line is dashed and the region is tinted and labelled.
zerobooleanfalseKeep zero on the value axis. Off by default: a band reads best when the axis hugs the data.
heightnumber280Height of the chart in px; the width follows the container.
format((n: number) => string)formatCompactFormats values in the tooltip and on the axis (the default axis format follows the tick step).
emptyStateReactNodeNoneShown when there is nothing to plot.
labelsPartial<RangeAreaChartLabels>defaultRangeAreaChartLabelsEvery other string, for translation: labels={{ instructions: "…" }}; omitted keys keep the English of defaultRangeAreaChartLabels. All 6 keys of RangeAreaChartLabels are listed in the key table under the props table.
aria-label (required)stringNoneAccessible summary of what the chart shows.
classNamestringNoneAdds extra classes to the outer element.
RangeAreaChartLabels keys and English defaults (6)
Pass any key in labels; the rest keep the defaults of defaultRangeAreaChartLabels.
KeyEnglish default
instructionsUse left and right arrow keys to read values.
forecastForecast
range(label) => `${label} range`
between(low: string, high: string) => /^[-−]/.test(low) || /^[-−]/.test(high) ? `${low} – ${high}` : `${low}–${high}`
missing–
emptyNo data

rangeAreaLegend / RangeAreaTable

PropTypeDefaultDescription
data (required)readonly ChartRow[]NoneThe rows to show: one object per row, holding the index key and the low and high keys of each series.
index (required)stringNoneThe key in each row that names the row, such as "day". It becomes the first column.
series (required)readonly RangeSeries[]NoneThe range series: each names the keys that hold its low and high values.
format((n: number) => string)formatCompactFormats each number in the table.
indexLabelstringNoneHeader of the first column; the index key when left out.
captionstringNoneVisually hidden caption naming the table for screen readers.
labelsPartial<RangeAreaChartLabels>defaultRangeAreaChartLabelsEvery other string, for translation: labels={{ instructions: "…" }}; omitted keys keep the English of defaultRangeAreaChartLabels. All 6 keys of RangeAreaChartLabels are listed in the key table under the props table.
forecastFromstringNoneMark rows from this x value on as forecast.
rangeAreaLegend(series, labels?)LegendItem[]NoneLegend items for ChartCard: each line, then its band, keyed as drawn.

Keyboard

KeysAction
TabFocus the chart. It is one tab stop; the arrow keys then read it.
←/→ (↑/↓)Previous / next point.
Home/EndJump to the first / last point.
EscapeClear the reading.

Accessibility

  • The chart is one focusable figure: its aria-label is the chart title, a one-line hint describes how to read it, and in a ChartCard with a table view aria-details points at that table. Each move is announced politely, once. Each move announces every line and its band as “low to high”; gaps are read as a dash, never as 0.
  • RangeAreaTable is the table view: pair it with ChartCard's table prop (Chart / Table tabs) so every value can be read without color or sight.
  • With reduced motion on, the band and its lines start at their final values and a data change jumps straight to the new state.

All exports on this page

  • RangeAreaChart — Lines with a shaded band around each (low to high): a forecast with its uncertainty, a min/max range, a confidence interval.
  • RangeAreaTable — The chart's table view: each line's value and its band as "low–high"; gaps read as a dash, never 0.
  • defaultRangeAreaChartLabels — The built-in English strings of RangeAreaChart; spread it into your own labels and change what you need.
  • rangeAreaLegend — Legend for a range chart: each line, then the band it carries, keyed exactly as drawn.

When to use the range area chart

  • Use it as a confidence interval chart for a revenue forecast, where forecastFrom marks the month actuals end and a dashed line and tinted region take over from the last actual value.
  • It suits daily temperature or price ranges, where each point has a low and a high and the line in the middle shows the typical value.
  • It also handles up to three lines with bands, such as two cities across the same two weeks, with overlapping bands kept lighter so both stay readable.
  • Skip it when you only have a single value per point, where LineChart is simpler, or when you need stacked parts of a total, where StackedAreaChart is the right shape.
  • Pair it with ChartCard and rangeAreaLegend so the legend names both the line and its band, and RangeAreaTable to show each value with its low to high range as text.

Frequently asked questions

48 charts pages in all: browse them on Charts.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .