Sparkline
Tiny inline trend line for tables and stat tiles.
Code
import * as React from 'react';
import { Sparkline, Stack } from '@fruit-labs/design';
export default function Demo() {
return (
<Stack direction="row" gap={3} align="center">
<b
style={{
fontVariantNumeric: 'tabular-nums',
}}
>
1,284
</b>
<Sparkline data={[4, 6, 5, 8, 7, 9, 12]} label="Trend, rising" />
</Stack>
);
}Install
From npm:
npm install @fruit-labs/design
import { Sparkline } from '@fruit-labs/design';Or copy the TypeScript source into your project:
npx shadcn@latest add https://design.fruitlabs.online/r/sparkline.jsonGuidelines
- No axes; pair with the current value as text.
Props
| Prop | Type | Required |
|---|---|---|
data | number[] | Yes |
width | number | No |
height | number | No |
color | string | No |
label | string | No |
className | string | No |