UI
LineChart
Smooth responsive line charts with multi-series, dashed lines, and dot control.
Preview
Installation
npm install recharts
Usage
import { LineChart } from '@/components/ui/LineChart'const data = [{ week: 'W1', pageViews: 12000, sessions: 4200 },{ week: 'W2', pageViews: 15400, sessions: 5100 },// ...]export default function Page() {return (<LineChartdata={data}xAxisKey="week"series={[{ dataKey: 'pageViews', name: 'Page Views', color: '#F45A5A' },{ dataKey: 'sessions', name: 'Sessions', color: '#6366f1' },]}/>)}
Variants
Dashed Line
No Dots / Linear
Prompt Preview
Copy a prompt that recreates this UI
Paste this into your AI coding assistant to generate code that closely matches the reference, including color, size, shape, typography, spacing, and polish.
Copy-ready AI prompt
Starts from the current visual reference and project constraints.
Tweak only product-specific copy or data after the first generation pass.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
data* | LineChartDataPoint[] | - | Array of data objects |
series* | LineChartSeries[] | - | Series definitions (dataKey, name, color, dashed, dot) |
xAxisKey* | string | - | Key in data for X axis labels |
height | number | 300 | Chart height in pixels |
showGrid | boolean | true | Show background grid lines |
showLegend | boolean | true | Show series legend |
showTooltip | boolean | true | Show hover tooltip |
smooth | boolean | true | Use curved (monotone) line interpolation |
className | string | - | Extra CSS classes for the wrapper |