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-tiny-sparkline

v1.0.0

Published

Tiny inline SVG sparkline charts for React. Line, area, bar, dot — with tooltips and animations. <2KB gzipped. Zero dependencies.

Readme

Features

  • 4 variants — line, area (gradient fill), bar, dot
  • Tooltips — hover to see values
  • CSS animation — smooth draw-in effect, respects prefers-reduced-motion
  • Min/max markers — highlight lowest and highest points
  • Trend indicator — arrow showing data direction (up/down/flat)
  • CSS Custom Properties--sparkline-color, --sparkline-fill for easy theming
  • Responsive — SVG viewBox scales to any container
  • SSR-safe — pure SVG, no window or document access
  • Tiny — ~1.8KB gzipped, zero dependencies

Install

npm install react-tiny-sparkline

Quick Start

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

function Dashboard() {
  return (
    <Sparkline data={[3, 5, 2, 8, 4, 7, 1, 6]} />
  );
}

Variants

<Sparkline data={data} variant="line" />   // Default
<Sparkline data={data} variant="area" />   // With gradient fill
<Sparkline data={data} variant="bar" />    // Bar chart
<Sparkline data={data} variant="dot" />    // Dot plot

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | data | number[] | required | Data points | | variant | 'line' \| 'area' \| 'bar' \| 'dot' | 'line' | Chart variant | | width | number | 100 | Width in px | | height | number | 32 | Height in px | | color | string | 'currentColor' | Stroke/fill color | | fillColor | string | — | Fill color for area variant | | strokeWidth | number | 2 | Stroke width | | animate | boolean | true | Animate on mount | | animationDuration | number | 500 | Animation duration in ms | | showMinMax | boolean | false | Show min (red) and max (green) markers | | showTrend | boolean | false | Show trend arrow (↑↓→) | | tooltip | boolean | false | Show value on hover | | formatTooltip | (value, index) => string | — | Custom tooltip formatter | | curved | boolean | false | Smooth curved line | | padding | number | 2 | Internal padding | | barGap | number | 0.2 | Gap ratio for bar variant (0-1) | | dotRadius | number | 3 | Dot radius for dot variant | | className | string | — | Additional CSS class | | style | CSSProperties | — | Additional inline styles | | aria-label | string | auto | Accessible label |

Examples

Dashboard stats

<Sparkline
  data={[12, 15, 8, 22, 18, 25, 20]}
  variant="area"
  color="#6366f1"
  showTrend
  width={120}
  height={40}
/>

Table inline chart

<Sparkline
  data={revenue}
  variant="bar"
  color="#22c55e"
  width={80}
  height={24}
  animate={false}
/>

With tooltips

<Sparkline
  data={[100, 250, 180, 420, 310]}
  tooltip
  formatTooltip={(v) => `$${v}`}
  showMinMax
  curved
/>

Theming

Customize via CSS Custom Properties:

:root {
  --sparkline-color: #6366f1;
  --sparkline-fill: #6366f1;
  --sparkline-min: #ef4444;
  --sparkline-max: #22c55e;
  --sparkline-trend-up: #22c55e;
  --sparkline-trend-down: #ef4444;
  --sparkline-trend-flat: currentColor;
}

Browser Support

Works in all modern browsers (Chrome 77+, Firefox 63+, Safari 13.1+, Edge 79+).

License

MIT