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

table-view-react

v1.3.8

Published

A customizable, reusable table component for React that allows dynamic row rendering, customizable headers, optional buttons in each row, and click event handling.

Readme

Table Component

A customizable, reusable table component for React that allows dynamic row rendering, customizable headers, optional buttons in each row, and click event handling.

Features

  • Display tabular data in a structured format.
  • Customize the appearance of headers and rows via props.
  • Optionally display buttons in each row, with a custom action when clicked.
  • Easily integrated into any React project.

1.3.7

  • Added props to color each cell manually

Installation

You can install the Table component via npm:

npm install table-view-react

Usage

  • To use the Table component, import it into your React component and pass the required props.

Example

import React from "react";
import { Table } from "table-view-react";

const data = [
  {
      "Antibody": "Agan1_HL",
      "Isoelectric point": 8.66,
      "Fv net charge": 6.2,
      "Hydrophobicity": -0.3252212389,
      "Extinction coeff": 48610,
      "BSA": 769.001,
      "Hydrodynamic radius": 23.8205643,
      "Helix ratio": 0.01327433628,
      "Sheet ratio": 0.5088495575,
      "PSH": 86.29281622,
      "PPC": 0.6291962302,
      "PNC": 0.08993442037,
      "PPA": 2348.12,
      "Solvation energy": -9233.929847,
      "Binding energy": 61.387924,
      "Dipole moment": 104.2520671,
      "Hydrophobic moment": 74763.15289,
      "Amphipathicity": 1.789992971,
      "SAP score": 107.213,
    },
    {
      "Antibody": "Agan2_HL",
      "Isoelectric point": 7.31,
      "Fv net charge": 2.1,
      "Hydrophobicity": -0.311790393,
      "Extinction coeff": 54110,
      "BSA": 876.184,
      "Hydrodynamic radius": 23.74849427,
      "Helix ratio": 0.03930131004,
      "Sheet ratio": 0.4978165939,
      "PSH": 65.52047064,
      "PPC": 0.3815383884,
      "PNC": 0.2261081658,
      "PPA": 1830.66,
      "Solvation energy": -7582.112303,
      "Binding energy": 102.0126113,
      "Dipole moment": 92.92275419,
      "Hydrophobic moment": 75747.94102,
      "Amphipathicity": 1.680330839,
      "SAP score": 85.065,
    },
];

const columnRanges = {
    "Isoelectric point": { low: 6, high: 8 },
    "Hydrophobicity": { low: -0.3, high: -0.2 },
    "SAP score": { low: 80, high: 100 },
    "Binding energy": { low: 20, high: 50 },
    "Fv net charge": { low: 0, high: 4 },
    "BSA": { low: 700, high: 800 },
    "Hydrodynamic radius": { low: 23.5, high: 24 },
    "Helix ratio": { low: 0.03, high: 0.04 },
    "Sheet ratio": { low: 0.48, high: 0.52 },
    "PSH": { low: 65, high: 75 },
    "PPC": { low: 0.4, high: 0.6 },
    "PNC": { low: 0.1, high: 0.3 },
    "PPA": { low: 1800, high: 2200 },
    "Solvation energy": { low: -8500, high: -7500 },
    "Dipole moment": { low: 90, high: 120 },
    "Hydrophobic moment": { low: 60000, high: 75000 },
    "Amphipathicity": { low: 0.8, high: 1.2 },
    "Extinction coeff": { low: 45000, high: 55000 },
  };

const handleButtonClick = (row) => {
  console.log("Button clicked for row:", row);
  alert(`You clicked on: ${JSON.stringify(row)}`);
};

const App: React.FC = () => (
  <div>
    <Table
      data={data}
      ranges={columnRanges}
      cellColors={{ light: "green", dark: "red" }}
      buttonText="Open"
      buttonFunction={handleButtonClick}
      headingColors={{ text: "blue", background: "#e0f7fa" }}
      rowColors={{ text: "black", background: "#f3f3f3" }}
    />
  </div>
);

export default App;

Component

<Table
  data={data}
  buttonText="View Details" // custom text for the button on the end column
  buttonFunction={customFunction} //return click row in object format
  headingColors={{ text: "blue", background: "#e0f7fa" }}
  rowColors={{ text: "black", background: "#f3f3f3" }}
  ranges={columnRanges} // ranges to color each cell
  cellColors={{ light: "green", dark: "red" }} // color ranges
/>

Props

| Prop | Type | Required | Default | Description | |---|---|---|---|---| | data | json | ✅ | N/A | displays json data in table format | The array of objects containing the data to be displayed in the table. | | onViewClick | function | ❌ | N/A | return clicked row | A function to be called when the "View" button is clicked for a specific row. | | headingColors | { text: string; background: string } | ❌ | { text: "black", background: "#f2f2f2" } | An object to customize the color of the table headers. text controls the text color and background controls the background color of the header. | | rowColors | { text: string; background: string } | ❌ | { text: "black", background: "white" } | An object to customize the color of table rows. text controls the text color and background controls the background color of each row. | | buttonText | string | ❌ | N/A | The text to be displayed on the button inside each row. If not provided, no button will be shown. | | buttonFunction | function | ❌ | N/A | A function to be called when the button in a row is clicked. returns clicked row in object format | | ranges | json | ❌ | N/A | Data to color each cell individually, pass the ranges in json format, the columns in json should match the column in table data | | cellColors | { light: "green", dark: "red" } | ❌ | N/A | colors according to the ranges from low to high |