Line Chart

Preview

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/line-chart

API Reference

LineChart

series
readonly XYSeries[]
Default—
categories
readonly string[]

Unique x-axis labels in display order. Values align with them by index.

Default—
variant?
"area" | "line"

`area` fills each line down to zero with a fading gradient.

Default—
curve?
"step" | "monotone" | "linear"
Default—
domain?
readonly [number, number]

Fixed value-axis bounds. Defaults to rounded bounds around the visible series.

Default—
activeId?
string | null

Inspected category, by label.

Default—
defaultActiveId?
string | null
Default—
onActiveChange?
((id: string | null) => void)
Default—
hiddenSeries?
readonly string[]

Series ids hidden through the legend.

Default—
defaultHiddenSeries?
readonly string[]
Default—
onHiddenSeriesChange?
((ids: readonly string[]) => void)
Default—
formatValue?
((value: number) => string)
Default—
formatTick?
((value: number) => string)

Axis tick labels. Defaults to compact notation (1.2K).

Default—
label?
string
Default—
status?
"ready" | "loading"

`loading` hides the lines behind a pulsing placeholder until your data arrives; switching to `ready` hands off to the draw-in. Keep one chart mounted across both states.

Default—
loadingLabel?
string

Shown over the placeholder while loading. An empty string hides it.

Default—
labels?
Partial<{ label: string; loading: string; loadingStatus: string; inspect: string; } & { noData: string; missing: string; dataCaption: string; category: string; total: string; series: string; seriesValue: string; totalValue: string; }>

Override any built-in string, including the shared `xyChart` ones.

Default—
className?
string
Default—

LineChartLegend

className?
string
Default—

LineChartPlot

height?
number

Plot height in px, excluding the category labels.

Default288
strokeWidth?
number

Stroke width of each line, in px.

Default2
showGrid?
boolean
Defaulttrue
fadeEdges?
boolean

Fade lines and fills out toward the left and right edges of the plot.

Defaulttrue
className?
string
Default—

LineChartTooltip

className?
string
Default—
side?
"auto" | "right" | "left"

`auto` sits right of the point, flips left near the right edge, and on plots too narrow for either moves above or below the point instead.

Defaultauto

Updated