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 🙏

© 2025 – Pkg Stats / Ryan Hefner

pace-table-lib

v1.0.23

Published

A simple React + Vite + TS UI library with a Button using custom fonts via SCSS

Readme


pace-table-lib

A lightweight React component library for rendering highly-configurable, Excel-like static tables with fixed headers, custom styles, and flexible measure formatting.


✨ Features

  • Fixed left columns (freeze columns/rows for better readability)
  • Grand total, row total, and column total support
  • Custom number formatting (comma separators, precision, display units, etc.)
  • Flexible styling via a single tableStyleProps object
  • Fully typed with TypeScript

📦 Installation

npm install pace-table-lib
# or
yarn add pace-table-lib

🔑 Basic Usage

import React from "react";
import { StaticTable } from "pace-table-lib";
import { createMeasureFormattingMapping } from "./measureFormatHelper";

export default function App() {
  const tableData = /* your JSON from API or file */;

  return (
    <StaticTable
      tableData={tableData?.TableData}
      leftFixedCellNameList={tableData?.leftFixedCellNameList ?? [""]}
      tableStyleProps={tableData?.TableStyle?.TableStyle?.Style}
      tableWidth={800}
      tableHeight={600}
      measureFormatConfigs={() => createMeasureFormattingMapping()}
    />
  );
}

⚙️ Props

| Prop | Type | Required | Description | | ------------------------- | --------------------------- | -------- | ----------------------------------------------------------- | | tableData | TableData | ✅ | Data object describing rows, columns, totals, and measures. | | leftFixedCellNameList | string[] | ❌ | Names of columns to freeze on the left. | | tableStyleProps | object | ❌ | Style configuration (colors, fonts, borders, etc.). | | tableWidth | number | ✅ | Total table width in pixels. | | tableHeight | number | ✅ | Total table height in pixels. | | measureFormatConfigs | () => MeasureFormatConfig | ✅ | Function returning measure formatting rules. |

MeasureFormatConfig

{
  measureName: string;      // e.g., "New Patients"
  numberFormat: string;     // e.g., "Comma Separated"
  displayUnit: string;      // e.g., "None", "K", "M"
  decimalPrecision: number; // e.g., 2
}

Example:

export const createMeasureFormattingMapping = () => ({
  measureName: "New Patients",
  numberFormat: "Comma Separated",
  displayUnit: "None",
  decimalPrecision: 2
});

📐 Table Data Structure

The component expects a JSON object similar to:

{
  "TableData": {
    "customSortRowwise": ["1L", "2L", "Adj"],
    "grandTotal": 400701,
    "measuresBySlice": [
      {
        "sliceMark": ["1L", "Base"],
        "measures": [0, 0, 81087],
        "rowTotal": 81087
      },
      ...
    ],
    "columnTotalRow": [
      { "columnTotal": 148247, "maxValueInColumn": 89526, "minValueInColumn": 0 }
    ],
    "dimensionMarks": [["HCC"], ["RCC"], ["SCLC"]],
    "totalNumberOfRows": 9
  },
  "leftFixedCellNameList": ["LOT", "Scenario"],
  "TableStyle": {
    "TableStyle": {
      "Style": { /* font, color, border config */ }
    }
  }
}

Use your own API or static file to populate this structure.


🖌 Styling

Pass the tableStyleProps from your data:

tableStyleProps={tableData?.TableStyle?.TableStyle?.Style}

It supports:

  • Row/Column header colors
  • Borders & grid lines
  • Conditional formatting (if enabled in your data)

🧩 TypeScript Support

The library ships with full type definitions. Import types as needed:

import { TableData, MeasureFormatConfig } from "pace-table-lib";

🛠 Development

Clone the repo and run:

npm install
npm run dev

📄 License

MIT © 2025


Quick Example

<StaticTable
  tableData={mockData.TableData}
  leftFixedCellNameList={["LOT", "Scenario"]}
  tableStyleProps={mockData.TableStyle.TableStyle.Style}
  tableWidth={1000}
  tableHeight={600}
  measureFormatConfigs={() => ({
    measureName: "New Patients",
    numberFormat: "Comma Separated",
    displayUnit: "None",
    decimalPrecision: 2
  })}
/>

This will render a scrollable, Excel-like table with frozen left columns and comma-separated numbers.