npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-sparkline-chart

v1.0.2

Published

Beautiful sparkline charts with smooth curves and gradient fills

Readme

✨ react-sparkline-chart

Beautiful sparkline charts with smooth curves and gradient fills. Zero dependencies beyond React.

Features

  • Smooth Catmull-Rom cubic Bezier curves
  • Vertical gradient fill that fades to transparent
  • Draw animation with animated prop
  • Fully responsive — uses SVG viewBox scaling
  • Non-scaling stroke width for consistent line thickness
  • Works with React 17, 18, and 19
  • Tree-shakeable ESM

Install

npm install react-sparkline-chart

Quick Start

import { Sparkline } from 'react-sparkline-chart';

function App() {
  return <Sparkline data={[5, 10, 5, 20, 8, 15]} />;
}

Examples

Custom Color

<Sparkline data={[1, 4, 2, 6, 3]} color="#10b981" />

No Fill

<Sparkline data={[1, 4, 2, 6, 3]} filled={false} />

Straight Lines

<Sparkline data={[1, 4, 2, 6, 3]} curved={false} />

Animated

<Sparkline data={[1, 4, 2, 6, 3]} animated />

Fixed Size

<Sparkline data={[1, 4, 2, 6, 3]} width={200} height={50} />

Title + Change Badge

<Sparkline data={[5, 10, 5, 20, 8, 15, 12, 18]} title="Revenue" showChange />

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | data | number[] | required | Array of numeric values to plot | | color | string | "#3b82f6" | Stroke and fill color | | width | number \| string | "100%" | SVG width | | height | number \| string | "100%" | SVG height | | strokeWidth | number | 2 | Stroke width in px (non-scaling) | | curved | boolean | true | Use smooth cubic Bezier curves | | filled | boolean | true | Show gradient fill beneath the line | | fillOpacity | number | 0.4 | Peak opacity of the gradient fill | | animated | boolean | false | Animate the line drawing on mount | | title | string | — | Label displayed above the sparkline | | titleSize | number | 14 | Title font size in px | | titleColor | string | — | Title color (defaults to 50% opacity inherit) | | showChange | boolean | false | Show percentage change badge above the sparkline | | className | string | — | CSS class on the <svg> | | style | CSSProperties | — | Inline styles on the <svg> |

How It Works

The component renders a pure SVG with a fixed 300x100 viewBox and preserveAspectRatio="none" so it stretches to fill its container. Data values are normalized to SVG coordinates, then rendered as either Catmull-Rom cubic Bezier curves (smooth) or straight polylines. The gradient fill uses an SVG <linearGradient> that fades vertically from the stroke color to transparent. Stroke uses vectorEffect="non-scaling-stroke" so the line thickness stays consistent regardless of container size.

Returns null when data has fewer than 2 points.

License

MIT