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

@gdmichelis/table-ui

v1.0.1

Published

A reusable React Table component library!

Downloads

248

Readme

table-ui

A reusable React Table component library!

Example

Example of reusable table

Installation

npm install @gdmichelis/table-ui

Importing the component into your React project

import { Table } from "@gdmichelis/table-ui";

Usage

Defining your headers and data

Your headers and data tables, could be fetched either via an external API, or defined hardcoded in your parent component of the Table component

const tableHeaders = ["Name", "Lastname", "Email"];

const usersData = [
  { Id: 1, Name: "David", Lastname: "Adams", Email: "[email protected]" },
  { Id: 2, Name: "Bill", Lastname: "Edwards", Email: "[email protected]" },
  { Id: 3, Name: "Mary", Lastname: "Thomson", Email: "[email protected]" },
  { Id: 4, Name: "Paul", Lastname: "Olson", Email: "[email protected]" },
  { Id: 5, Name: "Vicky", Lastname: "Sanders", Email: "[email protected]" },
];

//OR
const tableHeaders = ["Name", "Lastname", "Email"];

const res = await fetch("https://example.com/users", {});
const usersData = await res.json();

Rendering the component

// Now that you have your headers and data, you can pass them as props to your
// Table component like so:

function App() {
  return (
    <>
      <Table headers={tableHeaders} data={usersData}>
        <Table.StyledTableContainer>
          <Table.StyledTable>
            <Table.Head
              $backgroundColor="#04aa6d"
              $padding="0.5rem"
              $textAlign="left"
              $border="1px solid #ddd"
              $color="#fff"
            />
            <Table.Body
              $padding="0.5rem"
              $textAlign="left"
              $border="1px solid #ddd"
              $zebraEven="#f2f2f2"
            />
            <Table.Foot
              $backgroundColor="#04aa6d"
              $padding="0.5rem"
              $textAlign="left"
              $border="1px solid #ddd"
              $color="#fff"
            />
          </Table.StyledTable>
        </Table.StyledTableContainer>
      </Table>
    </>
  );
}

// ⚠ headers and data values must have the exact schema as displayed above!
// ⚠ Each data object must have an Id with numeric value

Styling the component

This library offers two ways to style your table:

1st way - Classic way via className prop

  // Each and very child component along with table component itself, can have a className prop
  // to target the corresponding HTML elements:

  <Table headers={tableHeaders} data={usersData}>
        <Table.StyledTableContainer className="table-container">
          <Table.StyledTable className="my-table">
            <Table.Head className="table-head"/>
            <Table.Body className="table-body"/>
            <Table.Foot className="table-foot"/>
          </Table.StyledTable>
        </Table.StyledTableContainer>
      </Table>

  // The Table component is consisted of below child components, and
  // must be present (except Table.Foot which is optionally and could be omitted) always:


   <Table.StyledTableContainer></Table.StyledTableContainer> // which is the parent container of the table
   <Table.StyledTable></Table.StyledTable> // the table itself
   <Table.Head /> // table header
   <Table.Body /> // table body
   <Table.Foot /> // table footer (optional)
/** In your CSS file */
.table-container {
}

.my-table {
}

.table-head {
}

.table-body {
}

.table-foot {
}

2nd way - Custom table

// Here you can specify any HTML table element css style property, by prepend the $ sign,
// e.g. $border = "1px solid #ddd"

<Table.Head
  $backgroundColor="#04aa6d"
  $padding="0.5rem"
  $textAlign="left"
  $border="1px solid #ddd"
  $color="#fff"
/>


<Table.Body
  $padding="0.5rem"
  $textAlign="left"
  $border="1px solid #ddd"
  $zebraEven="#f2f2f2"
  $backgroundColorHover="#ddd"
/>

// $zebraEven and $zebraOdd are props that implement the stripped pattern on the table
// on even or odd rows respectively.
// $backgroundColorHover value, changes table's row background color on hover.

Responsiveness

overflow-x: auto;
width: 50%;
width: 70%;
<Table.StyledTableContainer width="70%"></Table.StyledTableContainer>

Notice

table-ui uses styled-components library to style the Table component!

Contact

If you find any bug or you want to contribute to this project, please feel free to send me an email to: [email protected]

License

table-ui is MIT licensed.