Line chart
Plots one to eight series over dates or along a numeric scale.
import { LineChart } from '@uthereal/ui/line-chart'Line chart playground
Trial signups, Aug 23, 2026 to Sep 21, 2026. This period, latest 248. Previous period, latest 183.
| Date | This period | Previous period |
|---|---|---|
| Aug 23, 2026 | 128 | 121 |
| Aug 24, 2026 | 198 | 202 |
| Aug 25, 2026 | 192 | 198 |
| Aug 26, 2026 | 211 | 190 |
| Aug 27, 2026 | 206 | 182 |
| Aug 28, 2026 | 199 | 172 |
| Aug 29, 2026 | 130 | 121 |
| Aug 30, 2026 | 159 | 134 |
| Aug 31, 2026 | 254 | 218 |
| Sep 1, 2026 | 262 | 217 |
| Sep 2, 2026 | 247 | 226 |
| Sep 3, 2026 | 260 | 223 |
| Sep 4, 2026 | 253 | 231 |
| Sep 5, 2026 | 169 | 146 |
| Sep 6, 2026 | 158 | 121 |
| Sep 7, 2026 | 231 | 184 |
| Sep 8, 2026 | 239 | 203 |
| Sep 9, 2026 | 437 | 200 |
| Sep 10, 2026 | 338 | 181 |
| Sep 11, 2026 | 240 | 187 |
| Sep 12, 2026 | 139 | 118 |
| Sep 13, 2026 | 134 | 148 |
| Sep 14, 2026 | 250 | 235 |
| Sep 15, 2026 | 268 | 211 |
| Sep 16, 2026 | 262 | 230 |
| Sep 17, 2026 | 260 | 226 |
| Sep 18, 2026 | 268 | 232 |
| Sep 19, 2026 | 154 | 143 |
| Sep 20, 2026 | 176 | 147 |
| Sep 21, 2026 | 248 | 183 |
Overview
A line chart tracks continuous values across dates or numeric scales. Each series draws a 2 px stroke, with a subtle area wash under the first series and a toggleable legend for two or more series. Exploring the plot snaps a crosshair, per-series markers, and a unified tooltip to the nearest x value. The title names the figure for assistive technology without rendering a visible heading, and an accessible summary and data table expose every value.
Use one series for a single measure and multiple series only when comparing related series in the same unit. Never mix units on one chart. For a long, dense history, use a brush chart. To compare discrete categories, use a bar chart. For a headline KPI with an inline trend, use a metric card.
Usage
import { LineChart } from '@uthereal/ui/line-chart'
export function Seats() {
return (
<LineChart
title="Seats by plan"
series={[
{
id: 'team',
label: 'Team',
points: [
{ x: '2026-01-01', y: 410 },
{ x: '2026-02-01', y: 450 },
],
},
]}
/>
)
}Use either ISO date strings or numbers for x consistently across all series, with no duplicate x values within a series. Pass null for y to leave a gap in the line. Dates are positioned and formatted in UTC so server and client output match.
Examples
Dashed lines and custom colors
Set dashed: true on a series to render a dashed stroke (1.75 px, 4/5 dash pattern) for a target, forecast, or prior period. Set color (hex, rgb, hsl, oklch, or var(--token)) on a series to override its palette slot. The legend and tooltip match both settings.
Team seats, Jan 1, 2026 to Jun 1, 2026. Team, latest 610. Target, latest 645.
| Date | Team | Target |
|---|---|---|
| Jan 1, 2026 | 410 | 420 |
| Feb 1, 2026 | 450 | 465 |
| Mar 1, 2026 | 470 | 510 |
| Apr 1, 2026 | 520 | 555 |
| May 1, 2026 | 560 | 600 |
| Jun 1, 2026 | 610 | 645 |
Missing values and fitted value axis
area (enabled by default) renders a 9% wash under the first series and flattens it when that series is hidden. zero (enabled by default) starts the value axis at zero unless values drop below it. Set zero: false to fit the axis to the data range, and pass y: null to break the line at missing observations.
Weekly revenue, Mar 2, 2026 to Apr 6, 2026. Revenue, latest $22,900.
| Date | Revenue |
|---|---|
| Mar 2, 2026 | $18,200 |
| Mar 9, 2026 | $19,400 |
| Mar 16, 2026 | $17,800 |
| Mar 23, 2026 | – |
| Mar 30, 2026 | $21,300 |
| Apr 6, 2026 | $22,900 |
Loading and empty states
Set loading: true to dim and pulse existing lines while fetching new data; the plot sets aria-busy and announces loadingLabel. With no points, the plot shows emptyLabel ("No data for this range") or a loading placeholder when loading is active. When every series is hidden, the plot shows hiddenLabel ("Choose a series to show").
Loading
Seats by plan, Jan 1, 2026 to Jun 1, 2026. Team, latest 610. Business, latest 360. Enterprise, latest 170.
| Date | Team | Business | Enterprise |
|---|---|---|---|
| Jan 1, 2026 | 410 | 220 | 80 |
| Feb 1, 2026 | 450 | 240 | 95 |
| Mar 1, 2026 | 470 | 290 | 110 |
| Apr 1, 2026 | 520 | 300 | 120 |
| May 1, 2026 | 560 | 340 | 150 |
| Jun 1, 2026 | 610 | 360 | 170 |
Seats by plan. No data for this range.
| Date | Team |
|---|
Behavior
The value axis sits in a 48 px gutter at the inline end with at most four grid rows on clean steps (1, 2, 2.5, or 5 times a power of ten) and compact tick labels. The date axis beneath labels actual data points, spaced at least 76 px apart counting backward from the latest point so the newest label always appears.
Series colors follow configured series order: the first series uses the theme accent, the second uses ink at 46% over the surface, and remaining series use ink at 26%. Hiding a series via the legend keeps its slot and never repaints other series. All series can be hidden. The tooltip sits 14 px beside the crosshair, centered on the active markers, and flips sides before leaving the plot. Touch and pen drags scrub along x and release on lift while vertical swipes still scroll the page.
API reference
These serializable arguments and defaults come directly from the component schema.
| Argument | Type / default | Description |
|---|---|---|
title | stringDefault: "Line chart" | Figure title. It names the chart for assistive technology and captions the data table. |
description | string— | One or two sentences on what the chart shows, below the title; omit it when the title says enough. |
tableToggle | booleanDefault: false | Show a button that reveals the data table. The table is always available to assistive technology. |
tableLabel | stringDefault: "Data table" | Name of the data table button. |
noDataLabel | stringDefault: "No data" | Shown in the tooltip and announced for a missing value (null). |
valueFormat | NumberFormat— | How values appear in the tooltip, table and axis: decimal, percent or currency, with fraction digits. Axis ticks are compacted (12.9K). |
locale | string— | BCP 47 locale for numbers and dates. Omit it to inherit the application locale (en-US by default). |
series | ChartSeries[]Default: [{"id":"visits","label":"Visits","points":[{"x":"2026-01-01","y":3200},{"x":"2026-02-01","y":3500},{"x":"2026-03-01","y":3350},{"x":"2026-04-01","y":4100},{"x":"2026-05-01","y":4300},{"x":"2026-06-01","y":4720}]}] | One to eight series, each with an id, a label and { x, y } points. x is a number or an ISO date (the same kind in every series, not repeated within one); a null y leaves a gap. Colors follow the series order and never move when a series is hidden; a series may set its own color and a dashed stroke. A series may set its own color (hex, rgb, hsl, oklch or var(--token)) over its slot and dashed: true for a dashed stroke (Arc: 4 5 at 1.75px), e.g. a previous period or a target. |
xLabel | stringDefault: "Date" | Header of the x column in the data table. |
curve | linear | monotoneDefault: "monotone" | linear joins points with straight segments; monotone draws a smooth curve that never overshoots the data. |
area | booleanDefault: true | A 9% wash under the first series (Arc); it flattens with that series when it is hidden. |
zero | booleanDefault: true | Start the value axis at zero (unless the data dips below it); off fits the axis to the data. |
emptyLabel | stringDefault: "No data for this range" | Shown over the plot when there are no points to draw. |
loading | booleanDefault: false | Keep the current lines on screen, dimmed and breathing, while the host loads the next data; the plot is marked busy. |
loadingLabel | stringDefault: "Loading" | Announced politely while loading. |
legendToggle | booleanDefault: true | With two or more series, legend entries hide and show their series. |
legendLabel | stringDefault: "{title} series" | Accessible name of the legend group; {title} is filled in (Arc: "Trial signups series"). |
unit | string— | Unit after each value in the tooltip, the scrubber and the table, e.g. "ms". Axis ticks stay bare. |
exploreLabel | stringDefault: "{title}, explore by {category}" | Accessible name of the plot, a slider over the x positions. {title} and {category} (xLabel, lowercased) are filled in. |
scrubLabel | stringDefault: "{x}: {values}" | Value text of the slider at a point: {x} and {values}, each shown series as seriesValueLabel, comma separated ("Sep 21, 2026: This period 248, Previous period 183"). |
seriesValueLabel | stringDefault: "{series} {value}" | One series in scrubLabel; {series} and {value} (with the unit) are filled in. |
shownLabel | stringDefault: "{shown} of {count} series shown" | Value text of the slider at rest; {shown} and {count} are filled in ("2 of 2 series shown"). |
summaryLabel | stringDefault: "{title}, {from} to {to}." | Start of the visually hidden summary; {title}, {from} and {to} (the first and last x) are filled in. |
latestLabel | stringDefault: "{series}, latest {value}." | One series in the hidden summary; {series} and {value} (its latest value) are filled in. |
hiddenLabel | stringDefault: "Choose a series to show" | Shown over the plot when every series is hidden, which only the controlled hiddenSeries prop can do (the legend keeps one shown). |
height | integerDefault: 246 | Total height in pixels, axes included (120–640). The default 246 is Arc’s 220px plot plus its 26px date axis. |
recipe | studio | softDefault: "studio" | Visual treatment. Both recipes use the same interaction behavior. |
theme | LineChartTheme— | Color mode, accent, and tokens, including the chart palette (series1–series8). See Theming. |
motion | none | subtle | expressiveDefault: "subtle" | Draw-in and data change animation preset. System reduced-motion preferences take precedence. |
motionOptions | ChartMotionOptions— | draw (lines wiping in from the start once the chart scrolls into view) and morph (lines moving to new data): a tween with a duration (ms) or a spring. |
dir | ltr | rtl— | Reading direction of the text. The x axis always runs left to right. Omit it to inherit the page direction. |
React integration
| Prop | Purpose |
|---|---|
hiddenSeries | Controlled list of hidden series IDs |
defaultHiddenSeries | Initial hidden series IDs when uncontrolled |
onHiddenSeriesChange | Fires with the updated hidden series IDs when the legend toggles, in both modes |
onActiveChange | Fires with (index, x) as the crosshair moves, or (null, null) when it leaves |
preset | Application defaults, overridden by explicit instance props |
tokens | CSS variables applied after the typed theme |
ref | Ref forwarded to the root <figure> |
className, style | Applied to the root <figure> |
| Native attributes | id, data-*, and remaining <figure> attributes forwarded to the root |
Keyboard & accessibility
| Key | Interaction |
|---|---|
Tab | Focus the plot scrubber, then legend toggle pills |
ArrowLeft, Down | Step backward one x position |
ArrowRight, Up | Step forward one x position (starts at latest) |
PageUp, PageDown | Jump one sixth of the x positions |
Home, End | Jump to the first or last x position |
Escape | Clear the active crosshair and tooltip |
The chart renders a <figure> named by title and described by description. A visually hidden summary reports the range and each series' latest value (summaryLabel, latestLabel), and aria-details links to a native data table with one row per x value and one column per series. The SVG plot and floating tooltip are hidden from assistive technology.
The plot exposes a single role="slider" stop named by exploreLabel. Focus highlights the latest point without a separate box outline, showing the crosshair, markers, and tooltip while updating aria-valuetext via scrubLabel (or shownLabel at rest). Blurring clears exploration. In RTL, text follows the reading direction while x runs left to right. Under forced-colors, system colors apply and dashed series retain their dash pattern.
Motion and theming
Lines wipe in from the start once 30% of the chart enters the viewport (840 ms ease-in-out). Data updates spring on motionOptions.morph by resampling every line onto a shared x grid, while the value scale springs to its new range and hidden series flatten into the baseline as they fade. Gridlines and tick labels track the scale (240 ms fade-in, 120 ms fade-out). The crosshair jumps to the first explored point and glides on a snappy spring afterward; markers ride the curve and the tooltip tracks on its own spring. Lines containing gaps update immediately. motionOptions.draw and motionOptions.morph accept a tween with duration (ms) or a spring. Server-rendered markup is final. motion="none" and prefers-reduced-motion: reduce disable draw-in, morphs, glides, and fades.
theme accepts a mode, an accent, and semantic tokens; lines derive from accent, text, and surface unless overridden by a series' own color. An application-wide UtherealProvider supplies defaults.
Composition
In an agent composition, LineChart is a leaf with no actions. The host updates series through composition updates. See Building with agents.
{
"type": "LineChart",
"props": {
"title": "Weekly signups",
"series": [
{
"id": "signups",
"label": "Signups",
"points": [
{ "x": "2026-03-02", "y": 120 },
{ "x": "2026-03-09", "y": 150 }
]
}
]
},
"children": []
}