Skip to main content
LineChart connects data points with lines, making it ideal for showing trends over time. Each ChartSeries becomes a separate line, and x_axis labels the horizontal axis. See Charts for the shared data, series, and formatting model.

Basic Usage

Minimal

Set show_grid=False to remove the background gridlines. The line then reads as pure motion — useful in dense dashboards or inline trend callouts where direction matters more than precise values.

Smooth

Set curve="smooth" for gently curved lines between data points.

Step

Set curve="step" to connect points with step-shaped lines. This is useful for data that changes in discrete jumps.

With Dots

Set show_dots=True to render a dot at each data point along the lines.

Value Formatting

Use value_format to format numeric values on the value axis and in tooltips. It accepts the same pipe strings as Prefab expressions and data table columns, including currency, currency:EUR, percent:1, and compact:0.

API Reference

LineChart Parameters

data
list[dict] | str
required
Data as a list of dicts, or a {{ field }} interpolation reference.
series
list[ChartSeries]
required
Series definitions — each becomes a line on the chart.
x_axis
str | None
default:"None"
Data key for x-axis labels.
height
int
default:"300"
Chart height in pixels.
curve
Literal["linear", "smooth", "step"]
default:"\"linear\""
Interpolation curve between data points.
show_dots
bool
default:"False"
Show a dot at each data point.
show_legend
bool
default:"False"
Show a legend below the chart.
show_tooltip
bool
default:"True"
Show tooltips on hover.
show_grid
bool
default:"True"
Show horizontal grid lines.
show_y_axis
bool
default:"True"
Show the y-axis with its tick labels. Set to False for a compact, axis-free reading where the shape matters more than exact values.
value_format
str
default:"\"auto\""
Format value-axis ticks and tooltip values with an expression pipe such as currency, currency:EUR, percent:1, or compact:0.
css_class
str | None
default:"None"
Additional Tailwind CSS classes.

ChartSeries Parameters

data_key
str
required
Data field to plot — must match a key in the data dicts.
label
str | None
default:"None"
Display label for legends and tooltips. Defaults to the data_key value.
color
str | None
default:"None"
CSS color override. By default, colors cycle through the theme’s chart palette (--chart-1 through --chart-5).

Protocol Reference

LineChart
{
  "type": "LineChart",
  "id?": "string",
  "onMount?": "any",
  "data": "object[] | string (required)",
  "series": "[ChartSeries] (required)",
  "xAxis?": "string",
  "height?": "300",
  "curve?": "linear | smooth | step",
  "showDots?": false,
  "showLegend?": true,
  "showTooltip?": true,
  "animate?": true,
  "showGrid?": true,
  "showYAxis?": true,
  "valueFormat?": "string",
  "cssClass?": "string"
}
ChartSeries
{
  "dataKey": "string (required)",
  "label?": "string",
  "color?": "string"
}
For the complete protocol schema, see LineChart, ChartSeries.