UI

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

Trial signups, Aug 23, 2026 to Sep 21, 2026. This period, latest 248. Previous period, latest 183.

Trial signups
DateThis periodPrevious period
Aug 23, 2026128121
Aug 24, 2026198202
Aug 25, 2026192198
Aug 26, 2026211190
Aug 27, 2026206182
Aug 28, 2026199172
Aug 29, 2026130121
Aug 30, 2026159134
Aug 31, 2026254218
Sep 1, 2026262217
Sep 2, 2026247226
Sep 3, 2026260223
Sep 4, 2026253231
Sep 5, 2026169146
Sep 6, 2026158121
Sep 7, 2026231184
Sep 8, 2026239203
Sep 9, 2026437200
Sep 10, 2026338181
Sep 11, 2026240187
Sep 12, 2026139118
Sep 13, 2026134148
Sep 14, 2026250235
Sep 15, 2026268211
Sep 16, 2026262230
Sep 17, 2026260226
Sep 18, 2026268232
Sep 19, 2026154143
Sep 20, 2026176147
Sep 21, 2026248183
Loading interactive preview…

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

Team seats, Jan 1, 2026 to Jun 1, 2026. Team, latest 610. Target, latest 645.

Team seats
DateTeamTarget
Jan 1, 2026410420
Feb 1, 2026450465
Mar 1, 2026470510
Apr 1, 2026520555
May 1, 2026560600
Jun 1, 2026610645

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

Weekly revenue, Mar 2, 2026 to Apr 6, 2026. Revenue, latest $22,900.

Weekly revenue
DateRevenue
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").

Seats by plan

Loading

Seats by plan, Jan 1, 2026 to Jun 1, 2026. Team, latest 610. Business, latest 360. Enterprise, latest 170.

Seats by plan
DateTeamBusinessEnterprise
Jan 1, 202641022080
Feb 1, 202645024095
Mar 1, 2026470290110
Apr 1, 2026520300120
May 1, 2026560340150
Jun 1, 2026610360170
Seats by plan

No data for this range

Seats by plan. No data for this range.

Seats by plan
DateTeam

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.

ArgumentType / defaultDescription
titlestringDefault: "Line chart"Figure title. It names the chart for assistive technology and captions the data table.
descriptionstring—One or two sentences on what the chart shows, below the title; omit it when the title says enough.
tableTogglebooleanDefault: falseShow a button that reveals the data table. The table is always available to assistive technology.
tableLabelstringDefault: "Data table"Name of the data table button.
noDataLabelstringDefault: "No data"Shown in the tooltip and announced for a missing value (null).
valueFormatNumberFormat—How values appear in the tooltip, table and axis: decimal, percent or currency, with fraction digits. Axis ticks are compacted (12.9K).
localestring—BCP 47 locale for numbers and dates. Omit it to inherit the application locale (en-US by default).
seriesChartSeries[]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.
xLabelstringDefault: "Date"Header of the x column in the data table.
curvelinear | monotoneDefault: "monotone"linear joins points with straight segments; monotone draws a smooth curve that never overshoots the data.
areabooleanDefault: trueA 9% wash under the first series (Arc); it flattens with that series when it is hidden.
zerobooleanDefault: trueStart the value axis at zero (unless the data dips below it); off fits the axis to the data.
emptyLabelstringDefault: "No data for this range"Shown over the plot when there are no points to draw.
loadingbooleanDefault: falseKeep the current lines on screen, dimmed and breathing, while the host loads the next data; the plot is marked busy.
loadingLabelstringDefault: "Loading"Announced politely while loading.
legendTogglebooleanDefault: trueWith two or more series, legend entries hide and show their series.
legendLabelstringDefault: "{title} series"Accessible name of the legend group; {title} is filled in (Arc: "Trial signups series").
unitstring—Unit after each value in the tooltip, the scrubber and the table, e.g. "ms". Axis ticks stay bare.
exploreLabelstringDefault: "{title}, explore by {category}"Accessible name of the plot, a slider over the x positions. {title} and {category} (xLabel, lowercased) are filled in.
scrubLabelstringDefault: "{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").
seriesValueLabelstringDefault: "{series} {value}"One series in scrubLabel; {series} and {value} (with the unit) are filled in.
shownLabelstringDefault: "{shown} of {count} series shown"Value text of the slider at rest; {shown} and {count} are filled in ("2 of 2 series shown").
summaryLabelstringDefault: "{title}, {from} to {to}."Start of the visually hidden summary; {title}, {from} and {to} (the first and last x) are filled in.
latestLabelstringDefault: "{series}, latest {value}."One series in the hidden summary; {series} and {value} (its latest value) are filled in.
hiddenLabelstringDefault: "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).
heightintegerDefault: 246Total height in pixels, axes included (120–640). The default 246 is Arc’s 220px plot plus its 26px date axis.
recipestudio | softDefault: "studio"Visual treatment. Both recipes use the same interaction behavior.
themeLineChartTheme—Color mode, accent, and tokens, including the chart palette (series1–series8). See Theming.
motionnone | subtle | expressiveDefault: "subtle"Draw-in and data change animation preset. System reduced-motion preferences take precedence.
motionOptionsChartMotionOptions—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.
dirltr | rtl—Reading direction of the text. The x axis always runs left to right. Omit it to inherit the page direction.

React integration

PropPurpose
hiddenSeriesControlled list of hidden series IDs
defaultHiddenSeriesInitial hidden series IDs when uncontrolled
onHiddenSeriesChangeFires with the updated hidden series IDs when the legend toggles, in both modes
onActiveChangeFires with (index, x) as the crosshair moves, or (null, null) when it leaves
presetApplication defaults, overridden by explicit instance props
tokensCSS variables applied after the typed theme
refRef forwarded to the root <figure>
className, styleApplied to the root <figure>
Native attributesid, data-*, and remaining <figure> attributes forwarded to the root

Keyboard & accessibility

KeyInteraction
TabFocus the plot scrubber, then legend toggle pills
ArrowLeft, DownStep backward one x position
ArrowRight, UpStep forward one x position (starts at latest)
PageUp, PageDownJump one sixth of the x positions
Home, EndJump to the first or last x position
EscapeClear 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": []
}

On this page