Line Chart
Show how one or more values change over a sequence.
Loading example…
Installation
pnpm dlx shadcn@latest add @sui/line-chartInstall with the shadcn CLI or use the shared @workspace/ui package. Follow the installation guide to configure the registry, load styles, and choose import aliases.
Usage
import { LineChart } from "@workspace/ui/charts/line-chart";
<LineChart data={data} config={config} index="month" dots />;Reference lines
Recharts elements passed as children render inside the chart.
Loading example…
Customize
The wrapper covers common cases. For more control, pass Recharts elements as children, or compose your own chart with the Chart primitives.
API reference
| Prop | Type | Default / behavior |
|---|---|---|
curve | "linear" | "natural" | "monotone" | "step" | "natural". |
dots | boolean | false. |
index | string | Required. The category-axis key. |
categories | readonly string[] | Every key in config. |
showGrid / showXAxis / showYAxis | boolean | Grid and x axis on; y axis varies by chart. |
dir | "ltr" | "rtl" | "ltr". Mirrors the axes. |
data | readonly Record<string, unknown>[] | Required rows. |
config | ChartConfig | Required. Labels, colors and icons by key; series without a color use --chart-1 to --chart-5. |
valueFormatter | (value: number) => string | toLocaleString. Formats axes, tooltip and the screen-reader table; build one with numberFormatter. |
showLegend | boolean | false. Legend buttons show and hide series. |
showTooltip | boolean | true. |
loading | boolean | false. Shows a skeleton. |
labels | Partial<ChartLabels> | English labels; pass chartLabelsZhCN for Chinese. |
aria-label | string | Names the figure and captions its data table. |
className | string | Sizes the chart; defaults to a 16:9 box. |
children | ReactNode | Extra Recharts elements, such as ReferenceLine. |
The module also exports LineChartProps, numberFormatter, and the label presets chartLabels and chartLabelsZhCN. Screen readers get a hidden data table while the drawing itself is hidden from assistive technology, and animation is off when reduced motion is requested.