Componentcharts0.62 KB gzipZero dependencies
Sparkline
Lightweight SVG trend sparkline with animated end-point.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add sparklineOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { Sparkline } from "@/components/ui/sparkline"; <Sparkline data={[10, 25, 18, 42, 35, 60, 52, 85]} tone="accent" />Source code
sparkline.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxsparkline.tsx95 lines
import * as React from "react";import { cn } from "./lib/utils"; export interface SparklineProps extends React.SVGAttributes<SVGSVGElement> { data: number[]; width?: number; height?: number; strokeWidth?: number; tone?: "accent" | "foreground"; showArea?: boolean; className?: string;} export function Sparkline({ data, width = 140, height = 40, strokeWidth = 2,Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { Sparkline } from "@/components/ui/sparkline"; <Sparkline />| Prop | Type | Description |
|---|---|---|
| data | number[] | Dataset array rendered in charts, grids, or tables. |
| width | number | Configures width. (Default: 140) |
| height | number | Configures height. (Default: 40) |
| strokeWidth | number | Configures stroke width. (Default: 2) |
| tone | "accent" | "foreground" | Semantic surface or emphasis tone. (Default: "accent") |
| showArea | boolean | Toggles show area. (Default: true) |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |