Simulates prefers-reduced-motion for the demo. Off follows your system setting.
Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.
1
| month | Visitors | Returning |
|---|---|---|
| Jan | 1.8K | 920 |
| Feb | 2.1K | 1K |
| Mar | 2K | 1.1K |
| Apr | 2.6K | 1.2K |
| May | 3K | 1.4K |
| Jun | 2.9K | 1.5K |
| Jul | 3.3K | 1.5K |
| Aug | 3.6K | 1.7K |
| Sep | 3.4K | 1.8K |
| Oct | 4K | 1.9K |
| Nov | 4.3K | 2.2K |
| Dec | 4.6K | 2.4K |
A smooth line chart for one or more series over time.
npx shadcn@latest add ikislay/pixel-ui/line-chartimport { LineChart } from "@/components/ui/line-chart"const data = [{ month: "Jan", visits: 1200 },{ month: "Feb", visits: 1900 },{ month: "Mar", visits: 1600 },]export function Demo() {return (<LineChartlabel="Visits by month"data={data}index="month"series={[{ key: "visits", label: "Visits" }]}
1// Loading…
Options you can pass to customize this component.
data*Record<string, string | number>[]One object per point along the x axis.
index*stringThe key in each object that labels the x axis.
series*{ key: string; label?: string; color?: string }[]The keys to plot. Colors follow the chart palette in order unless you set one.
label*stringNames the chart for screen readers and captions its data table.
heightnumberHeight in pixels. The width fills the parent.
format(value: number) => stringFormats values wherever the chart shows them. Defaults to short numbers like 12.4K.
curvesmoothlinearSmooth bends through every point without overshooting it; linear joins them with straight lines.
classNamestringMerged onto the root element.