LineChart
Trend over time: 2px lines, crosshair + tooltip on hover, optional area for one series, table view.
Code
import * as React from 'react';
import { LineChart } from '@fruit-labs/design';
export default function Demo() {
return (
<LineChart
title="Active users"
subtitle="Weekly · sample data"
area
labels={['W1', 'W2', 'W3', 'W4', 'W5', 'W6', 'W7', 'W8']}
series={[
{
name: 'Active users',
data: [820, 910, 880, 1040, 1120, 1090, 1260, 1340],
},
]}
/>
);
}Area
import { LineChart } from '@fruit-labs/design';
export default function Example() {
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: 12, maxWidth: 560 }}>
<LineChart area title="Active users" labels={['Jan', 'Feb', 'Mar', 'Apr']} series={[{ name: 'Users', data: [120, 180, 160, 240] }]} />
</div>
);
}Install
From npm:
npm install @fruit-labs/design
import { LineChart } from '@fruit-labs/design';Or copy the TypeScript source into your project:
npx shadcn@latest add https://design.fruitlabs.online/r/line-chart.jsonGuidelines
- One y-axis only; two measures of different scale → two charts.
Props
| Prop | Type | Required |
|---|---|---|
width | number | No |
labels | string[] | Yes |
series | Array<{ name: string; data: number[]; color?: string }> | Yes |
area | boolean | No |
height | number | No |
title | React.ReactNode | No |
subtitle | React.ReactNode | No |
format | (v: number) => string | No |
allowTable | boolean | No |
className | string | No |