Examples

Two series, currency values

Hover or focus the chart and use the arrow keys.

Preview
Revenue and costs, 2026Line chart of Revenue and Costs, 12 points from Jan to Dec. Revenue: lowest $58,400 (Feb), highest $84,210 (Dec). Up 37.6% from first to last. Costs: lowest $40,900 (Feb), highest $51,400 (Dec). Up 22.1% from first to last.
  • Revenue
  • Costs
Use the arrow keys to move between data points, Home and End to jump to the first and last.
Example.tsx
import { LineChart } from '@reactloom/charts';
import { monthly } from './data';

export default function Example() {
  return (
    <LineChart
      title="Revenue and costs, 2026"
      data={monthly}
      x="month"
      series={[
        { key: 'revenue', label: 'Revenue' },
        { key: 'costs', label: 'Costs' },
      ]}
      valueFormat={{ style: 'currency', currency: 'USD', maximumFractionDigits: 0 }}
    />
  );
}

Dates on the x axis

A written description states the takeaway; ticks are spaced by date.

Preview
Daily active users, NovemberUsage grew about 30% over the month, with the usual dip at weekends.
Use the arrow keys to move between data points, Home and End to jump to the first and last.
Example.tsx
import { LineChart } from '@reactloom/charts';
import { daily } from './data';

export default function Example() {
  return (
    <LineChart
      title="Daily active users, November"
      description="Usage grew about 30% over the month, with the usual dip at weekends."
      data={daily}
      x="day"
      xFormat={{ month: 'short', day: 'numeric' }}
      series={[{ key: 'users', label: 'Active users' }]}
      curve="monotone"
      height={220}
    />
  );
}

Stacked areas

Each band is one channel; the top edge is the total.

Preview
Sign-ups by channelMobile grew fastest: 53% more sign-ups in Q4 than in Q1.
  • Web
  • Mobile
  • Partner
Use the arrow keys to move between data points, Home and End to jump to the first and last.
Example.tsx
import { AreaChart } from '@reactloom/charts';
import { quarterly } from './data';

export default function Example() {
  return (
    <AreaChart
      title="Sign-ups by channel"
      description="Mobile grew fastest: 53% more sign-ups in Q4 than in Q1."
      data={quarterly}
      x="quarter"
      stacked
      series={[
        { key: 'web', label: 'Web' },
        { key: 'mobile', label: 'Mobile' },
        { key: 'partner', label: 'Partner' },
      ]}
    />
  );
}

API reference

LineChart props
PropTypeDefault
titlerequired
Names the figure; shown above it unless hideTitle.
string—
datarequired
Row[]—
xrequired
X value of each row. Dates and numbers get a continuous axis.
key | (row) => string | number | Date—
seriesrequired
value defaults to row[key]; null is a gap.
{ key, label, value?, color? }[]—
description
The takeaway. Generated from the data when omitted.
ReactNode—
valueFormat
Currency, percent, units. Axis ticks add compact notation.
Intl.NumberFormatOptions—
formatValue · formatX
Your own formatting.
(value) => string—
xFormat
For date x values. Default: month and day.
Intl.DateTimeFormatOptions—
xLabel · yLabel
Axis titles.
string—
yDomain
Fix the value axis.
[min, max]—
curve
'linear' | 'monotone''linear'
points
Default: shown up to 24 points.
boolean—
stacked (AreaChart)
boolean—
table
'toggle' | 'visible' | 'none''toggle'
height
number280
loading · emptyState
boolean · ReactNode—
messages
Translate built-in text.
Partial<ChartMessages>—

Customization

Series colours are the theme tokens --pl-color-chart-1 to --pl-color-chart-6, used in order. Set them in a theme (createTheme({ colors: { 'chart-1': '#0E7C66' } }), contrast-checked by checkThemeContrast) or per series with color.

Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.

LineChart

Renders CartesianChart, so its hooks apply too.

State attributes

Target these in your CSS to style states without depending on class names.

AttributeValues
[data-series]present when on
[data-zero]present when on

Theme tokens it reads

--pl-color-bg-subtle --pl-color-bg-surface --pl-color-border-default --pl-color-border-strong --pl-color-border-subtle --pl-color-fg-muted --pl-color-fg-subtle --pl-focus-ring-color --pl-focus-ring-offset --pl-focus-ring-width --pl-font-size-sm --pl-font-size-xs --pl-radius-md --pl-radius-sm --pl-radius-xs

AreaChart

Renders CartesianChart, so its hooks apply too.

State attributes

Target these in your CSS to style states without depending on class names.

AttributeValues
[data-series]present when on
[data-zero]present when on

Theme tokens it reads

--pl-color-bg-subtle --pl-color-bg-surface --pl-color-border-default --pl-color-border-strong --pl-color-border-subtle --pl-color-fg-muted --pl-color-fg-subtle --pl-focus-ring-color --pl-focus-ring-offset --pl-focus-ring-width --pl-font-size-sm --pl-font-size-xs --pl-radius-md --pl-radius-sm --pl-radius-xs

Accessibility

  • Each chart is a <figure> named by its title and described by a summary. Write the description yourself to state the takeaway; otherwise a factual summary is generated from the data (range, lowest and highest values, change from first to last), formatted for the active locale.
  • The drawing is hidden from assistive technology. Screen-reader users get the summary and the data table (“Show data table”), which is a real, sortable table.
  • The plot is one tab stop. Arrow keys move between data points, a visible tooltip follows, and a polite live region reads the values. It is not role="application", so screen readers keep their normal reading keys; in browse mode, use the table.
  • Colours come from the theme’s chart palette, each at least 3:1 against the background in every built-in theme. In Windows high-contrast mode series switch to system colours with dash patterns.
  • In right-to-left layouts the x axis runs from the right and the value axis moves to the right side; ← moves forward.
Keyboard interactions
KeyAction
TabFocus the plot
→ / ↓Next point (← in right-to-left layouts)
← / ↑Previous point
Home / EndFirst / last point
EscapeHide the tooltip

Usage guidelines

Do

  • Write a description that says what the reader should notice.
  • Keep to four series or fewer; split the rest into small multiples.

Don’t

  • Don’t use a line for categories that have no order — use a BarChart.
  • Don’t stack series that can be negative.