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.jsonRevenue forecast
RangeAreaChartRangeAreaTablerangeAreaLegenddefaultRangeAreaChartLabels- +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
import { ChartCard } from "@/components/sheenui/charts/chart-parts/chart-card";
import { formatCompact, type ChartRow } from "@/components/sheenui/charts/chart-utils";
import { rangeAreaLegend, RangeAreaTable, RangeAreaChart, type RangeSeries } from "@/components/sheenui/charts/range-area-chart";
// Package build (after the first npm release, or a packed tarball): import { ChartCard, rangeAreaLegend, RangeAreaTable, RangeAreaChart, formatCompact, type ChartRow, type RangeSeries } from "@sheenui/theme";
const data: ChartRow[] = [
{ month: "Jun", revenue: 51 },
{ month: "Jul", revenue: 56 },
{ month: "Aug", revenue: 60, low: 60, high: 60 },
{ month: "Sep", revenue: 63, low: 59.5, high: 66.5 },
{ month: "Oct", revenue: 66, low: 60, high: 72.5 },
{ month: "Nov", revenue: 70, low: 61.5, high: 79 },
];
const series: RangeSeries[] = [{ key: "revenue", label: "Revenue", lower: "low", upper: "high", bandLabel: "80% interval" }];
export function Example() {
return (
<ChartCard
title="Revenue forecast"
legend={rangeAreaLegend(series)}
table={<RangeAreaTable data={data} index="month" series={series} forecastFrom="Sep" />}
>
<RangeAreaChart
data={data}
index="month"
series={series}
forecastFrom="Sep"
format={(n) => "$" + formatCompact(n) + "K"}
aria-label="Monthly revenue with a forecast and its 80% interval"
/>
</ChartCard>
);
}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.tsxcomponents/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.tslib/{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
import { type ChartRow } from "@/components/sheenui/charts/chart-utils";
import { RangeAreaChart, type RangeSeries } from "@/components/sheenui/charts/range-area-chart";
// Package build (after the first npm release, or a packed tarball): import { RangeAreaChart, type ChartRow, type RangeSeries } from "@sheenui/theme";
const days: ChartRow[] = [
{ day: "1", lisbon: 15.2, lisbonLow: 11, lisbonHigh: 20, oslo: 2.4, osloLow: -1.2, osloHigh: 5.9 },
{ day: "2", lisbon: 16.1, lisbonLow: 12.3, lisbonHigh: 21.2, oslo: 3.1, osloLow: -0.4, osloHigh: 6.8 },
{ day: "3", lisbon: 14.8, lisbonLow: 10.5, lisbonHigh: 19.4, oslo: 1.7, osloLow: -2, osloHigh: 5 },
{ day: "4", lisbon: 15.9, lisbonLow: 11.8, lisbonHigh: 20.6, oslo: 2.9, osloLow: -0.9, osloHigh: 6.2 },
];
const series: RangeSeries[] = [
{ key: "lisbon", label: "Lisbon", lower: "lisbonLow", upper: "lisbonHigh", bandLabel: "Lisbon low–high", color: 2 },
{ key: "oslo", label: "Oslo", lower: "osloLow", upper: "osloHigh", bandLabel: "Oslo low–high", color: 7 },
];
export function Example() {
return (
<RangeAreaChart
data={days}
index="day"
series={series}
format={(n) => n + "°"}
aria-label="Daily mean temperature with the low–high range"
/>
);
}Props
RangeAreaChartLabels keys and English defaults (6)
rangeAreaLegend / RangeAreaTable
Keyboard
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
Related pages
48 charts pages in all: browse them on Charts.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .