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-table-diff

v0.1.0

Published

A React component for row & cell level table diff — beyond line-by-line text diff

Readme

react-table-diff

A React component for row & cell level table diff — beyond line-by-line text diff.

License: MIT

react-table-diff screenshot

✨ Highlights

  • 🔍 Row & Cell Diff — Added, modified, deleted, and unchanged rows with inline old → new highlighting
  • 🪄 Smart Ordering — Deleted rows appear at their original position, not lumped at the end
  • 🎨 Themeable — CSS custom properties compatible with @git-diff-view, dark mode ready
  • 🛡️ Zero Dependencies — Only React as a peer dependency
  • Universal — ESM + CJS + TypeScript declarations

🌱 Install

npm install react-table-diff

🚀 Quick Start

import { TableDiff, computeTableDiff } from 'react-table-diff';

const oldRows = [
  { id: '1', name: 'Alice', email: '[email protected]' },
  { id: '2', name: 'Bob',   email: '[email protected]' },
  { id: '3', name: 'Charlie', email: '[email protected]' },
];

const newRows = [
  { id: '1', name: 'Alice', email: '[email protected]' },  // modified
  { id: '2', name: 'Bob',   email: '[email protected]' },        // unchanged
  { id: '4', name: 'Diana', email: '[email protected]' },      // added
  // id: '3' (Charlie) is deleted
];

const diff = computeTableDiff({
  oldRows,
  newRows,
  columns: ['name', 'email'],
  rowKey: 'id',
});

function App() {
  return (
    <TableDiff
      diff={diff}
      columns={[
        { id: 'name', label: 'Name' },
        { id: 'email', label: 'Email' },
      ]}
    />
  );
}

🧩 API

computeTableDiff(options)

Pure function that computes the diff between two sets of rows.

| Option | Type | Default | Description | |-----------|-----------------------------|----------|----------------------------------------| | oldRows | Record<string, unknown>[] | — | Rows from the base version | | newRows | Record<string, unknown>[] | — | Rows from the current version | | columns | string[] | all keys | Column ids to compare | | rowKey | string | "id" | Key used to match rows across versions |

Returns a TableDiffResult:

interface TableDiffResult {
  addedRows: DiffRow[];
  modifiedRows: ModifiedDiffRow[];
  deletedRows: DiffRow[];
  unchangedRows: DiffRow[];
  rows: TaggedDiffRow[];  // all rows in display order
}

💡 The rows array follows the new table's row order, with deleted rows inserted at their original position relative to surviving neighbours.

<TableDiff />

| Prop | Type | Description | |--------------|---------------------------------------------------------|--------------------------------| | diff | TableDiffResult | Result from computeTableDiff | | columns | DiffColumn[] | Column definitions { id, label } | | labels | { noChanges?: string } | Custom labels | | renderCell | (value, columnId, row) => ReactNode \| undefined | Custom cell renderer | | className | string | CSS class for root element |

🎨 Theming

Colors are controlled via CSS custom properties, compatible with @git-diff-view/react:

:root {
  --diff-add-content--: #dafbe1;
  --diff-add-content-highlight--: #aceebb;
  --diff-add-lineNumber--: #aceebb;
  --diff-del-content--: #ffebe9;
  --diff-del-content-highlight--: #ffcecb;
  --diff-del-lineNumber--: #ffcecb;
  --diff-plain-content--: #fff;
  --diff-plain-lineNumber--: #fafafa;
  --diff-plain-lineNumber-color--: #555;
  --diff-hunk-content-color--: #777;
  --diff-border--: #dedede;
}
[data-theme="dark"] {
  --diff-add-content--: #253d38;
  --diff-add-content-highlight--: #306e58;
  --diff-add-lineNumber--: #253d38;
  --diff-del-content--: #402830;
  --diff-del-content-highlight--: #6e3848;
  --diff-del-lineNumber--: #402830;
  --diff-plain-content--: #262c3a;
  --diff-plain-lineNumber--: #2c3348;
  --diff-plain-lineNumber-color--: #a0aec0;
  --diff-hunk-content-color--: #a0aec0;
  --diff-border--: #3a4560;
}

🐣 Example

cd examples/basic
npm install
npm run dev

Opens a demo at http://localhost:5173 with sample data and a dark mode toggle.

🛸 License

MIT