Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Line chart

Trends over time, one series or several on separate axes. Brushes, forecast bands, event markers and synced cursors are children you add as needed.

On this page21 sections

Preview

Preview width

Installation

The command adds the example above to components/charts/ and, the first time, the chart kit to components/ui/charts/. Both are source files in your project from then on: read them, change them, delete what you don't use.

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

Usage

Each row needs a Date under date, or under the key you pass as xDataKey, and a number for each series.

import {
  ChartTooltip,
  Grid,
  Line,
  LineChart,
  XAxis,
} from "@/components/ui/charts";

const data = [
  { date: new Date(2026, 9, 1), visitors: 1180 },
  { date: new Date(2026, 9, 2), visitors: 1320 },
  { date: new Date(2026, 9, 3), visitors: 1260 },
  { date: new Date(2026, 9, 4), visitors: 1510 },
  { date: new Date(2026, 9, 5), visitors: 1470 },
];

export const VisitorsChart = () => (
  <LineChart ariaLabel="Daily visitors" data={data}>
    <Grid horizontal />
    <Line dataKey="visitors" label="Visitors" stroke="var(--chart-1)" />
    <XAxis />
    <ChartTooltip />
  </LineChart>
);

Anatomy

Children draw in the order you write them: the grid first, the lines over it, the tooltip on top.

<LineChart data={data}>
  <Grid horizontal />
  <Line dataKey="revenue" label="Revenue" />
  <Line dataKey="costs" label="Costs" stroke="var(--chart-2)" />
  <XAxis />
  <YAxis />
  <ChartTooltip />
</LineChart>
  • LineChart: Holds the rows, sizes the plot and draws everything inside it.
  • Grid: Horizontal and vertical guide lines.
  • Line: One series, read from dataKey.
  • XAxis: Date labels along the bottom.
  • YAxis: Value labels. A second one with its own yAxisId sits on the right.
  • ChartTooltip: The crosshair, the dots, the date pill and the panel.

Two scales

Give a <Line> a yAxisId and add a <YAxis> with the same id and orientation="right". Each axis scales to its own series, so revenue in dollars and conversion in percent can share one time axis.

Pass formatValue to each axis for its units. The default axis id is left.

Preview width

Provisional data

Set dashFromIndex on a <Line> and it turns dashed from that row on. Use it for days that haven't settled yet or for a stretch you estimated. dashArray sets the pattern.

Preview width

Event markers

<ChartMarkers items={events} /> pins events to their dates above the plot. Events on the same day stack into one marker that fans out on hover, and the tooltip lists the events on the hovered date.

Preview width

Ranges and forecasts

<Band> shades the space between two fields of each row, lowerKey and upperKey, such as a forecast's low and high estimate. Place it before the <Line> so the line stays on top.

For a path beyond your data, <ProjectionLine> draws a dotted forecast from the last point.

Preview width

Selecting a range

Add <SegmentBackground />, <SegmentLineFrom /> and <SegmentLineTo />, and a drag across the plot selects a stretch of days. A component inside the chart reads the selected rows from useChart().selection.

Preview width

Brush and zoom

<ChartBrushLayout> puts a small overview strip under the chart. Dragging or resizing its window sets the main chart's xDomain, which keeps a year of daily data readable.

To zoom without a strip, add <ChartZoom />. Ctrl or Cmd with the wheel zooms around the pointer, a drag pans, a double-click resets.

Preview width

Linked charts

Charts with the same syncId share one cursor: hover a day on one and the others show it too. Add syncY when small multiples should use the same y scale.

To move the focus from outside the chart, for example from a table row, pass activeIndex and listen to onActiveIndexChange.

Preview width

Saving as an image

Put <ChartExportButton /> in the card's header and it saves the chart in that card as a PNG, or as an SVG with format="svg". The file shows the chart at rest, in the current theme's colors, with its fonts embedded.

For your own control, bind the ref of useChartExport() to the element around the chart and call its download, toPng or toSvg.

Preview width

Large data

Lines stay fast as SVG well past 100,000 rows a series: the drawn path is decimated to about 1.5 points a pixel, and hover still finds every row.

Past about 50,000 rows a series, or with several dense series, pass renderer={canvasRenderer} to each <Line>. The lines paint on one canvas while the grid, axes, crosshair and tooltip stay SVG. On a canvas the lines dim together on hover and fadeEdges has no effect.

Preview width

Customization

The kit is in your project, in components/ui/charts/: your framework's components over a shared core/. Change a default there and every chart picks it up.

className goes on the chart's container, so size and spacing are utility classes.

To change what the tooltip says, pass content: it gets the hovered row and its index and returns the panel's contents. If you only need different labels or values, rows replaces the rows and keeps the default panel.

<ChartTooltip
  content={({ point }) => (
    <TooltipBox>
      <div className="px-3 py-2 text-sm">
        {Number(point.visitors).toLocaleString()} visitors
      </div>
    </TooltipBox>
  )}
/>

Where a part renders content of its own, you pass it in. In React:

  • ChartTooltip: content={({ point, index }) => …}

Loading state

Pass status="loading" while the rows are on their way. The line turns into a pulsing skeleton over a shimmering grid and ignores the pointer. Switch to "ready" and the data is revealed on the same chart, without a remount.

loadingLabel puts a short line of text over the skeleton. When there's no data to pass at all, render <LineChartLoading /> in the chart's place.

Preview width

Animation

The line draws in from the left over animationDuration, 1100 ms by default. Set it to 0 to skip the entrance, or pass animationEasing for a different curve.

New data doesn't replay the entrance. The line redraws in place and the y scale glides to its new range over yDomainTweenDuration (500 ms). Change revealSignature when you do want the entrance again.

If the reader has reduced motion turned on, the chart skips to its final frame.

Preview width

Theming

Every color in the kit is one of your theme's tokens or a mix of them, except --chart-positive, a fixed green. A preset or the .dark class restyles the chart, and overriding a token in your CSS changes it everywhere.

Series colors are props: stroke="var(--chart-3)" on a <Line>. A line without one uses --chart-line-primary.

TokenDefaultPaints
--chart-1your theme'sthe first series
--chart-2your theme'sthe second series
--chart-line-primary--chart-1a series with no color of its own
--chart-grid--bordergrid lines
--chart-label--muted-foregroundtick labels
--chart-crosshair--muted-foreground at 75%the hover line
--chart-tooltip-background--popoverthe tooltip panel
--chart-date-pill-background--primarythe date pill on hover
globals.css
:root {
  --chart-line-primary: var(--chart-3);
  --chart-grid: var(--muted);
}

Accessibility

The chart is announced as an image named by ariaLabel ("Line chart" unless you pass one). Add ariaDescription for the takeaway, since a screen reader can't see the shape of the line.

Tab
Moves focus to the chart.
Arrow Right
Moves to the next row. ArrowDown does the same.
Arrow Left
Moves to the previous row. ArrowUp does the same.
Home
Jumps to the first row.
End
Jumps to the last row.

FAQ

When should I use a line chart instead of an area or bar chart?

Use a line chart when the question is how a value moves over time and the direction matters more than the amount. Lines stay readable with several series, where filled areas would cover each other.

Pick an area chart when the volume under the curve is the point, and a bar chart to compare separate categories or a handful of periods.

What data does the line chart need?

An array of rows, one per point in time. Each row holds a Date under date, or under the key you pass as xDataKey, and one number for each series. A timestamp works in place of a Date.

A <Line> reads its series with dataKey, so another series is one more key on the rows and one more <Line>.

How do I show two series with different units on one line chart?

Give the second <Line> a yAxisId and add a <YAxis> with the same id and orientation="right". Each axis scales to its own series, so revenue in dollars and a conversion rate in percent can share one time axis.

Pass formatValue to each <YAxis> so its tick labels carry their unit.

How do I mark a forecast or unfinished data on a line chart?

Set dashFromIndex on a <Line> and the line turns dashed from that row on, which suits days that haven't settled yet.

For a range around the line, <Band> shades the space between a lowerKey and an upperKey on each row. <ProjectionLine> continues the line past your last point as a dotted path.

How do I zoom into a date range on a line chart?

<ChartBrushLayout> adds an overview strip under the chart: dragging or resizing its window sets the main chart's xDomain. To zoom on the plot itself, add <ChartZoom />, where Ctrl or Cmd with the wheel zooms, a drag pans and a double-click resets.

For fixed ranges such as 7, 30 or 90 days, filter the rows you pass. The line redraws in place and the y scale glides to the new range.

How many points can a line chart draw before it slows down?

As SVG, a line stays fast well past 100,000 rows a series: the drawn path is thinned to about 1.5 points a pixel, and hover still finds every row.

Past about 50,000 rows a series, or with several dense series, pass renderer={canvasRenderer} to each <Line>. The lines then paint on one canvas while the grid, axes, crosshair and tooltip stay SVG.

How do I change what the line chart's tooltip shows?

Pass content to <ChartTooltip>: it receives the hovered row and its index and returns the panel's contents. To keep the default panel and change only its labels or values, pass rows.

Axis labels have their own formatter. formatValue on <XAxis> turns a tick's date into text, and on <YAxis> it formats the value.

How do I size a line chart and keep it readable on a phone?

The chart fills its container's width and takes its height from aspectRatio, 2 / 1 by default. Change the ratio, or set a fixed height on the container with className or style.

On a narrow chart, fewer tick labels fit. numTicks on <XAxis> takes one count, or a count per breakpoint such as { base: 3, md: 6 }.

Which frameworks does the line chart support?

React, Vue, Svelte and Solid. One core on TanStack Charts draws the line chart in each, so the components and props on this page are the same everywhere, and switching framework at the top of the page changes the preview, the code and the install command.

Only the spelling follows the framework: class for className outside React, scoped slots for render props in Vue and snippets in Svelte.

How do I add the line chart to my project?

Sign in, then copy the command under Installation: npx shadcn@latest add with the chart's URL. It adds the example at the top of this page as components/charts/chart-line-default, the chart kit to components/ui/charts the first time you install a chart, and @tanstack/charts.

Both are source files in your project from then on. Swap the sample rows for your own data and change whatever you need.

Is the line chart free?

Yes. The line chart and every example of it are free to use in personal and commercial projects. Seeing the code and installing it takes a free account, one tap with Google or GitHub.

The charts are bklit's (bklit-ui, MIT), rebuilt on TanStack Charts and drawn in your shadcn/ui theme's tokens.

API reference

LineChart

PropType
dataChartDatum[]

The rows to plot. Each row is an object holding the x value under xDataKey and one number per series under that series' dataKey.

xDataKey?string

Key of the x value in each row. The value must be a Date (or something new Date() accepts, such as a timestamp).

Default
"date"
status?ChartStatus

"loading" shows the loading state (skeleton line, grid shimmer, optional label) and ignores the pointer; switching to "ready" reveals the real data on the same chart instance.

Default
"ready"
animationDuration?number

Duration of the entrance reveal in milliseconds. 0 skips the animation.

Default
1100
margin?Partial<ChartMargin>

Space around the plot area in pixels, for axis labels and the tooltip. Missing sides use the default.

Type
Partial<ChartMargin>
Default
{ top: 40, right: 40, bottom: 40, left: 40 }
aspectRatio?string

CSS aspect ratio of the chart ("width / height" or a number), applied to the container width.

Default
"2 / 1"
className?string

Extra CSS class name for the chart container.

onPhaseChange?(phase: ChartPhase) => void

Called with "loading" or "ready" when status changes (and once on mount).

Type
(phase: ChartPhase) => void
childrenReactNode

The layers to draw: Grid, Line, XAxis, YAxis, ChartTooltip and the other chart children.

loadingLabel?string

Text shown centered over the chart, with a shimmer, while status is "loading". Nothing is shown when it is unset or empty.

style?CSSProperties

Inline styles for the chart container, for example a fixed height for a brush strip.

animationEasing?string

CSS easing of the entrance reveal (a cubic-bezier(…), linear, ease-in-out…). enterTransition takes priority.

Default
"cubic-bezier(0.85, 0, 0.15, 1)"
yDomainTween?boolean

Animate the y domain when the data or status changes instead of jumping to the new scale.

Default
true
yDomains?Readonly<Record<string, YDomainOverride>>

Per-axis y-domain overrides, keyed by yAxisId ("left" for the default axis): a fixed [min, max], or a function of the auto domain (before it is niced) that returns the one to use, e.g. { left: ([, max]) => [0, max * 3] }. Hoist the object out of render.

Type
Readonly<Record<string, YDomainOverride>>
yDomainTweenDuration?number

Duration in milliseconds of the y-domain tween (a data update, the loading to ready handoff, a brushed window).

Default
500
xDomain?[Date, Date]

Visible x range as [start, end], used for brush zoom. The chart plots only this range of data.

xDomainSlotCount?number

Length of the full dataset while xDomain zooms into part of it. It keeps the x spacing consistent with the unzoomed chart.

enterTransition?EnterTransition

The entrance reveal as a motion transition: its duration (seconds) and ease (a cubic-bezier array or a CSS easing) override animationDuration and animationEasing. A reveal is always a tween.

yScaleDomainMax?number

Fixed top of the y domain on a single-axis chart: the domain becomes [0, yScaleDomainMax × 1.1] (niced) instead of following the data, leaving headroom above the series or keeping several charts on one scale.

revealSignature?string

Changing this string replays the entrance animation. Do not change it when only the data changes.

ariaLabel?string

Accessible name of the chart.

Default
"Line chart"
ariaDescription?string

Longer accessible description of the chart, exposed as aria-description.

syncId?string

Charts with the same syncId move together: hovering or keyboard-focusing one shows the crosshair, dots and date pill at the same date on the others (the same category, for bar charts), and a ChartBrush or ChartZoom in a time chart zooms the time charts of the group to its window.

syncY?boolean

With syncId: every chart of the group draws on one y scale (the union of their data), so small multiples compare at a glance. Read by LineChart and AreaChart.

Default
false
activeIndex?number | null

Index into data of the row to focus (crosshair, dots and tooltip), for example the row a table has under the pointer. null clears it.

Type
number | null
onActiveIndexChange?(index: number | null) => void

Called with the index into data of the row the pointer or keyboard focuses, and with null when the focus leaves.

Type
(index: number | null) => void

Line

PropType
dataKeystring

Key of the data field that holds this line's y values.

label?string

Name of the series in the default tooltip row and the chart context's \lines\ (what a legend built from them reads). Defaults to \dataKey\.

stroke?string

Stroke color of the line.

Default
"var(--chart-line-primary)"
strokeWidth?number

Stroke width of the line in px.

Default
2.5
curve?CurveFactory

d3-shape curve factory used to interpolate between points.

Default
curveNatural
yAxisId?string | number

Id of the y scale this line is plotted against. Use it with a matching YAxis to give a series its own scale.

Type
string | number
Default
"left"
fadeEdges?FadeEdges

Fade the line toward transparent at the chart edges. true fades both ends, "left" or "right" fades one side, false turns the fade off, and { left, right } sets each side's fade zone as a percentage of the plot width (0-50).

Default
true
strokeGradient?StrokeGradient

A colour ramp across the plot, left to right: plain colours are spaced evenly, { offset, color } stops (offset 0-1) place them. It composes with fadeEdges and replaces stroke for the line's paint (stroke still colours the markers and the tooltip dot).

glow?boolean | Readonly<LineGlow>

A soft outer glow: a blurred copy of the stroke behind the line. true uses the defaults; { blur, opacity, strokeWidth } tunes it.

Type
boolean | Readonly<LineGlow>
Default
false
showHighlight?boolean

Draw a highlighted segment of the line around the hovered point.

Default
true
highlight?Readonly<LineHighlight>

The hover highlight's styling: colour or ramp, width, soft ends (fadeLength), glow, span and how far the rest of the line dims (dimOpacity). See LineHighlight.

Type
Readonly<LineHighlight>
showMarkers?boolean

Draw a circle marker at every data point.

Default
false
markers?Readonly<SeriesPointMarkerStyle>

Styling of the point markers drawn by showMarkers. See SeriesPointMarkerStyle.

Type
Readonly<SeriesPointMarkerStyle>
dashFromIndex?number

Data index from which the line is drawn dashed (inclusive). Useful for marking an incomplete or projected period.

dashArray?string

Dash pattern of the dashed tail when dashFromIndex is set.

Default
"6,4"
loadingStroke?string

Stroke color of the loading pulse overlay.

Default
"var(--chart-foreground)"
loadingStrokeOpacity?number

Stroke opacity of the loading pulse overlay.

Default
0.5
animate?boolean

Whether the point markers animate in. The line itself always enters with the chart's animationDuration.

Default
true
loading?boolean

Show the loading pulse overlay on this line. When unset, the pulse follows the chart's status. Set false to disable it even while the chart is loading.

loadingPulseMode?LineLoadingPulseMode

Phase of the loading pulse: "loop" repeats, "exit" plays the loading to ready transition, "enter" plays ready to loading.

Default
"loop"
loadingStyle?LoadingStyle

Loading animation: a travelling "pulse" or a diagonal "sweep" shimmer across the skeleton line.

Default
"pulse"
onLoadingPulseCycleComplete?() => void

Called each time a "loop" pulse cycle completes.

Type
() => void
renderer?ChartMarkRenderer

Where the line draws: "svg", a path, or canvasRenderer, a bitmap the chart's canvas lines share, for tens of thousands of points (the grid, axes, hover highlight, markers, glow, crosshair and tooltip stay SVG). On a canvas the line dims with the others on hover (a legend can't dim it alone) and doesn't take a fadeEdges mask.

Default
"svg"

Grid

PropType
horizontal?boolean

Show horizontal grid lines.

Default
true
vertical?boolean

Show vertical grid lines.

Default
false
numTicksRows?number

Number of horizontal grid lines. Ignored when rowTickValues is set.

Default
5
numTicksColumns?number

Number of vertical grid lines.

Default
10
rowTickValues?number[]

Explicit y values for the horizontal grid lines. Overrides numTicksRows.

stroke?string

Color of the grid lines.

Default
"var(--chart-grid)"
loadingStroke?string

Grid color while the chart is loading. Falls back to stroke.

strokeOpacity?number

Opacity of the grid lines.

Default
1
strokeWidth?number

Width of the grid lines in px.

Default
1
strokeDasharray?string

Dash pattern of the grid lines.

Default
"4,4"
highlightRowValues?number[]

Y values of horizontal lines drawn with the highlight styling, for example a zero baseline.

highlightRowStroke?string

Color of the highlighted rows.

Default
"var(--chart-foreground-muted)"
highlightRowStrokeOpacity?number

Opacity of the highlighted rows.

Default
1
highlightRowStrokeWidth?number

Width of the highlighted rows in px.

Default
1
highlightRowStrokeDasharray?string

Dash pattern of the highlighted rows.

Default
"0"
fadeHorizontal?boolean

Fade the horizontal lines toward transparent at the left and right edges.

Default
true
fadeVertical?boolean

Fade the vertical lines toward transparent at the top and bottom edges.

Default
false
hideHorizontalEdgeLines?boolean

Drop the first and last horizontal line (kept when two or fewer remain).

Default
false
hideVerticalEdgeLines?boolean

Drop the first and last vertical line (kept when two or fewer remain).

Default
false
shimmer?boolean

While the chart is loading, sweep a bright band across the grid.

Default
false
shimmerStroke?string

Color of the shimmer band.

Default
"color-mix(in oklch, var(--bkm-foreground) 68%, transparent)"
shimmerSpeed?number

Speed multiplier of the shimmer sweep. 2 is twice as fast.

Default
1

XAxis

PropType
numTicks?number | ResponsiveChartLabelCount

Target number of tick labels along the x axis, or one per chart width: { base, sm, md, lg, xl } takes the count of the widest breakpoint the chart reaches (640, 768, 1024 and 1280 px).

Type
number | ResponsiveChartLabelCount
Default
5
labels?readonly string[]

The tick text of each data row, in row order: it replaces the date formatting (pair it with ChartTooltip dateLabels).

tickerHalfWidth?number

Half-width in px of the zone around the date pill inside which tick labels are hidden. Line, area and composed charts widen it to the pill's half-width plus the widest tick label's, so no label sits half under the pill.

Default
50
tickMode?"domain" | "data"

Where ticks fall: "data" places them on evenly spaced data rows, "domain" places them at evenly spaced time values across the x domain.

Type
"domain" | "data"
Default
"data"
formatValue?(value: Readonly<Date>) => string

Formats a tick date into its label. Defaults to a short month and day such as "Jan 5".

Type
(value: Readonly<Date>) => string

YAxis

PropType
yAxisId?string | number

Id of the y scale this axis labels. Must match the yAxisId of the series that use it.

Type
string | number
Default
"left"
orientation?"left" | "right"

Side of the plot the axis sits on. The primary axis is on the left; additional axes default to the right.

Type
"left" | "right"
Default
"left"
numTicks?number

Target number of tick labels. The primary axis also sets the number of horizontal grid lines.

Default
5
formatLargeNumbers?boolean

Abbreviate values of 1000 and above as thousands, with one decimal where needed, for example 2k or 1.5k.

Default
true
formatValue?(value: number) => string

Formats a tick value into its label. Overrides formatLargeNumbers.

Type
(value: number) => string

ChartTooltip

PropType
showDatePill?boolean

Show the date pill that rides along the bottom of the plot.

Default
true
showCrosshair?boolean

Show the vertical crosshair line. Bar charts leave it off unless this is true (the dots and the category pill mark the bar).

Default
true
showDots?boolean

Show a dot on every series at the hovered position.

Default
true
dotVariant?"dot" | "ring"

Dot style: a filled "dot" or a transparent "ring" square. Read by BarChart only.

Type
"dot" | "ring"
Default
"dot"
dotSize?number

Dot radius in px.

Default
5
dotRadiusFraction?number

Corner radius of the "ring" variant as a fraction of its side (0 is square, 0.5 is a circle). Read by BarChart only.

Default
0.25
dotScale?number

Multiplier applied to the dot or ring size. Read by BarChart and LiveLineChart.

Default
1
dotStrokeWidth?number

Stroke width of the dots in px.

Default
2
indicatorColor?string | ((point: Record<string, unknown>) => string)

Color of the crosshair. Only a string is applied; the function form that bklit-ui accepts is ignored and the default is used.

Type
string | ((point: Record<string, unknown>) => string)
Default
"var(--chart-crosshair)"
content?(props: { point: Record<string, unknown>; index: number; pinned?: boolean; dismiss?: () => void }) => ReactNode

Replaces the default tooltip panel body. Receives the hovered data row and its index; with pinnable, also whether the panel is pinned and a dismiss that unpins it (for a close button in a pinned panel's detail).

Type
(props: { point: Record<string, unknown>; index: number; pinned?: boolean; dismiss?: () => void }) => ReactNode
pinnable?boolean

A click (or Enter, or Space) on the chart pins the tooltip where it is: the panel takes the pointer, so its content can grow into detail and hold controls, until another click, Escape or dismiss lets it go.

Default
false
rows?(point: Record<string, unknown>) => { readonly color: string; readonly label: string; readonly value: string | number }[]

Replaces the default rows (one per series) with your own list of { color, label, value }.

Type
(point: Record<string, unknown>) => { readonly color: string; readonly label: string; readonly value: string | number }[]
dotColor?string | ((point: Record<string, unknown>, line: ChartLineConfig) => string)

Fill of the tooltip dots. A function receives the hovered row and the series config, and is called again each time the hovered row changes. Defaults to each series' color; a ProfitLossLine's dot takes the color of the hovered value's sign.

Type
string | ((point: Record<string, unknown>, line: ChartLineConfig) => string)
children?ReactNode

Extra content rendered below the rows in the default panel, for example marker details. Without it, a chart with ChartMarkers lists the markers on the hovered date there.

className?string

Extra class name for the tooltip panel.

springConfig?SpringConfig

Spring for the floating panel when matchCrosshair is on. Defaults to the chart's tooltip spring.

matchCrosshair?boolean

Make the floating panel follow the pointer with the same spring as the crosshair instead of damping.

Default
false
damping?number

Spring damping for the floating panel when matchCrosshair is off, on bklit's 0 to 100 scale: lower is bouncier, higher slower, 0 moves the panel instantly. The default, 20, is the snappy hover spring (stiffness 3600, damping 120); every other value is bklit's spring for it played six times faster.

Default
20
indicatorDasharray?string

Dash pattern of the crosshair. Omit for a solid line.

indicatorFadeEdges?IndicatorFadeEdges

Vertical fade of the crosshair: both ends, the top, the bottom, or none (solid).

Default
"both"
indicatorFadeLength?number

Size of the crosshair's fade, as a percentage of its height (2 to 40).

Default
10
indicatorEndColor?string

Bottom colour of the crosshair: it ramps from indicatorColor at the top to this at the bottom (composes with the fade).

indicatorEnd?"plot" | "point"

How far down the crosshair reaches: the whole plot, or down to the hovered point of the first series.

Type
"plot" | "point"
Default
"plot"
dotHaloBlur?number

Blur in px on the dots' halo, for a soft glow.

Default
0
topOffset?number

Extra gap in px between the top of the plot and the tooltip panel.

Default
0
dateLabels?readonly string[]

The date pill's text for each data row, in row order (pair it with XAxis labels).

boxSpringConfig?SpringConfig

Spring for the floating panel. Takes priority over matchCrosshair and damping.

indicatorWidth?IndicatorWidth

Thickness of the crosshair: a width in px, or "line" (1px), "thin" (2px), "medium" (4px) or "thick" (8px).

Default
"line"

LineChartLoading

PropType
style?CSSProperties

Inline styles for the placeholder container. With aspectRatio: "unset" and a height the placeholder fills that height at any width, for example to hold a LiveLineChart's style.height while its stream connects.

margin?Partial<ChartMargin>

Space around the plot area in pixels. Missing sides use the default.

Type
Partial<ChartMargin>
Default
{ top: 40, right: 40, bottom: 40, left: 40 }
stroke?string

Color of the traveling loading segment.

Default
"var(--bkm-foreground)"
strokeOpacity?number

Opacity of the traveling loading segment.

Default
0.5
gridStroke?string

Color of the grid lines while loading. Use color-mix or an oklch alpha to set the opacity.

Default
"color-mix(in oklch, var(--chart-grid) 50%, transparent)"
gridShimmerStroke?string

Color of the shimmer band that travels across the grid. Use color-mix or an oklch alpha to set the opacity.

Default
"color-mix(in oklch, var(--bkm-foreground) 68%, transparent)"
gridShimmer?boolean

Animate a shimmer band across the grid lines. Always off when loadingStyle is "sweep".

Default
true
gridShimmerSpeed?number

Shimmer speed multiplier; higher is faster.

Default
1
loadingStyle?LoadingStyle

Loading animation: "pulse" sends a bright segment along the line, "sweep" sweeps a soft diagonal shimmer across it.

Default
"pulse"
label?string

Text shown centered over the placeholder, with a shimmer. An empty string hides it.

Default
"Loading"
aspectRatio?string

CSS aspect ratio of the placeholder, as "width / height".

Default
"2 / 1"
className?string

Extra CSS class name for the placeholder container.

Default
""

ChartExportButton

PropType
children?ReactNode

The button's label: a download icon and the format by default.

format?ChartExportFormat

The file's format.

Default
"png"
filename?string

The file's name, with or without its extension: the chart's label, made a file name, by default.

exporter?ChartExporter

What to export: the element exporter.ref is bound to. By default, the chart nearest the button (its card's content).

background?string

What the export is painted on: the surface the chart sits on by default (its nearest painted ancestor's background, such as its card's, resolved for the current theme), any CSS colour (var(--card) too), or "transparent".

scale?number

Pixel density of a PNG: its size is the chart's times scale.

Default
2
embedFonts?boolean

Embed the web fonts the chart's text is set in (each @font-face it uses, as data), so the file renders in them anywhere. A PNG is drawn from the same svg, so it needs them too.

Default
true
settle?boolean

Export the chart at rest: leave a hover or keyboard focus on it (tooltip, crosshair, dimmed series) and wait for its running transitions and entrance to finish (up to 2 s) before reading it. false exports it exactly as it is now.

Default
true
label?string

The file's accessible name (its <title> and aria-label): the chart's own (ariaLabel) by default.