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

awesome-kpi-leader-board

v0.1.0

Published

Awesome Leaderboard component for KPI ranking, trend tracking, and performance monitoring!

Readme

Awesome KPI Leaderboard

Enterprise-grade KPI Leaderboard component for React with smart health scoring, anomaly detection, theming, filtering, and performance optimizations.

Features

  • Smart KPI Health Engine (achievement, status, trend, health score)
  • Anomaly detection based on historical deviation
  • Ranking and rank movement indicators
  • Trend sparkline and trend direction
  • Contribution percent
  • Filtering (text + numeric) and status filter
  • Column reordering and resizing with drag and drop
  • Themes: Light, Dark, Purple
  • Performance optimizations with memoization and optional virtualization

Installation

npm install awesome-kpi-leader-board

Basic Usage

import { AwesomeLeaderboard } from "awesome-kpi-leader-board";

export default function App() {
  return (
    <AwesomeLeaderboard
      data={[]}
      title="Enterprise KPI Leaderboard"
      subtitle="Regional revenue performance"
      theme="light"
      showTrend
      showContribution
      showVariance
      showRankMovement
    />
  );
}

Examples

No CSS import needed — styles are injected automatically.

Example 1 — Dark theme with sample data

import { AwesomeLeaderboard } from "awesome-kpi-leader-board";
import { data } from "awesome-kpi-leader-board/sample_data";

export default function App() {
  return (
    <AwesomeLeaderboard
      data={data}
      title="Global KPI Leaderboard"
      subtitle="Quarterly performance"
      theme="dark"
      showTrend
      showContribution
      showVariance
      showRankMovement
    />
  );
}

Example 2 — Bottom view with limited rows

import { AwesomeLeaderboard } from "awesome-kpi-leader-board";
import { data } from "awesome-kpi-leader-board/sample_data";

export default function App() {
  return (
    <AwesomeLeaderboard
      data={data}
      title="Bottom Performers"
      subtitle="Areas needing attention"
      view="bottom"
      maxRows={8}
      virtualize
      listHeight={420}
      showTrend={false}
    />
  );
}

Example 3 — Custom health thresholds

import { AwesomeLeaderboard } from "awesome-kpi-leader-board";
import { data } from "awesome-kpi-leader-board/sample_data";

export default function App() {
  return (
    <AwesomeLeaderboard
      data={data}
      title="KPI Health Deep Dive"
      subtitle="Custom thresholds"
      achievementThresholds={{ excellent: 115, onTrack: 95, warning: 75 }}
      showTrend
      showContribution={false}
      showVariance
    />
  );
}

Props

| Prop | Type | Default | Description | | ----------------------- | --------------------------------- | ----------------------------------- | ------------------------------------------------------- | | data | Array<object> | [] | Static dataset. | | dataUrl | string | "" | URL to JSON file (expects { data: [] } or raw array). | | apiEndpoint | string | "" | API endpoint returning JSON data. | | title | string | "KPI Leaderboard" | Header title. | | subtitle | string | "Enterprise performance snapshot" | Header subtitle. | | theme | "light" \| "dark" \| "purple" | "light" | Theme selection. | | maxRows | number \| null | null | Max rows to display. null shows all. | | sortBy | string | "rank" | Reserved (sorting removed from UI). | | sortDirection | "asc" \| "desc" | "asc" | Reserved (sorting removed from UI). | | showTrend | boolean | true | Show trend sparkline. | | showContribution | boolean | true | Show contribution percent. | | showVariance | boolean | true | Show variance percent. | | showRankMovement | boolean | true | Show movement arrow. | | highlightTop | number | 3 | Highlight top N rows. | | onRowClick | (row) => void | undefined | Row click callback. | | locale | string | "en-US" | Locale for number formatting. | | currency | string | "USD" | Currency code for formatting. | | view | "top" \| "bottom" | "top" | Initial list view. | | rowHeight | number | 72 | Row height for virtualization. | | virtualize | boolean | true | Enable virtualization when maxRows is set. | | listHeight | number | 520 | Max list height. | | achievementThresholds | { excellent, onTrack, warning } | {110, 90, 70} | Achievement thresholds for status. | | varianceThresholds | { green, amber } | {5, -5} | Reserved (legacy). |

Smart KPI Health Engine

Achievement

achievement = (metricValue / target) * 100;

Status

if (achievement >= 110) status = "Excellent";
else if (achievement >= 90) status = "On Track";
else if (achievement >= 70) status = "Warning";
else status = "Critical";

Trend Direction

const last = trendData[trendData.length - 1];
const prev = trendData[trendData.length - 2];

trendDirection = last > prev ? "up" : last < prev ? "down" : "stable";

Health Score

healthScore =
  achievement * 0.7 +
  (trendDirection === "up" ? 30 : trendDirection === "down" ? -30 : 0);

Health RAG

if (healthScore >= 90) healthRag = "green";
else if (healthScore >= 70) healthRag = "amber";
else healthRag = "red";

Anomaly Detection

const avg = trendData.reduce((a, b) => a + b, 0) / trendData.length;
const deviation = Math.abs(metricValue - avg) / avg;
const anomaly = deviation > 0.35;

The implementation only flags anomalies when:

  • Sudden drop vs average
  • Trend direction is down
  • Achievement is below 90%

Tooltip

If anomaly is detected, a red tooltip appears:

⚠ Anomaly Detected
Sudden drop of x% vs historical average

Data Structure

{
  id: "RET001",
  entityName: "Mumbai Store",
  metricValue: 1250000,
  target: 1100000,
  previousRank: 2,
  trendData: [980000,1050000,1100000,1180000,1250000]
}

Performance

  • useMemo for derived datasets
  • useCallback for stable handlers
  • Row virtualization for large datasets

Notes

  • Ranking is computed automatically from metricValue (desc).
  • Rank movement uses previousRank if provided.
  • Column resizing and reordering are enabled by drag interactions.