DocsComponentsTemplatesThemesGitHub

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.json

Guidelines

  • No axes; pair with the current value as text.

Props

PropTypeRequired
datanumber[]Yes
widthnumberNo
heightnumberNo
colorstringNo
labelstringNo
classNamestringNo

Edit this example on GitHub