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

v0.2.1

Published

Fast and easily configurable tables in React. Has some built-in, easy to use APIs, but also fully customizable.

Readme

React-Smooth-Table

Fast and easily configurable tables in React. Has some built-in, easy to use APIs, but also fully customizable.

Table of Contents

Installation

npm install [--save] react-smooth-table

Basic usage

Simple example:

import React from 'react';
import { Table } from 'react-smooth-table';

const TableComponent = () => {
  const columns = [
    { headerFor: 'name', title: 'Name' },
    { headerFor: 'phoneNum', title: 'Phone number' },
  ];

  const data = [
    { name: 'John Doe', phoneNum: '123456789' },
    { name: 'Jane Doe', phoneNum: '987654321' },
  ];

  return <Table columns={columns} data={data} />;
};

So in the most basic use-case the Table component takes two props: columns and data. Both of them is an array of objects. Note: The value for the headerFor key must be the same as the key of the data which you want to display.
Note: Any key-values in data which doesn't have a headerFor in the columns won't be displayed.

Customization

The Table component can take the following props: |Prop|Type|Explanation| |----|----|-----------| |height|string (eg: '100%'|The height of the table.| |width|string (eg: '500px'|The width of the table| |padding|string (eg: '1em')|Padding between the table and its outer container| |stickyHeader|boolean|If true, the header stays at the top when scrolling| |striped|boolean|If true, every second row has a darker color (can be customized)| |stripeColor|string (eg: '#f0f0f0")|The color of the text in the striped rows. Can be any valid css color value| |stripeBg|string (eg: 'silver')|The backgroundcolor of the striped rows. Can be any valid css color value| |headerColor|string (eg:'rgba(0, 0, 0, 0.5)'|Textcolor of the header. Can be any valid css color value.| |headerBg|string|Bacgkround color of the header. Can be any valid css color value.| |editable|boolean|If true, it allows the access to the editComponents prop| |editComponents|object|Pass in callbacks and components to the edit/add/delete operations examples here| |onRowClick|function|You can pass in a callback which takes the data of the row that's been clicked on| |onOrder|function|A callback that's fired when the ordering is changed by clicking on one of the header items. It gets 2 arguments: order and orderBy. Order can be one of 'ASC' or 'DESC', and orderBy is the headerFor of the column|

Advanced styling

You can also style a single column, by passing in more arguments into the respective column object, for example:

const columns = [
  { headerFor: 'id', title: 'Identification', width: '50px', align: 'right' },
];

Possible props for the column object:
|Prop|Type|Explanation| |-----|------|-----| |width|string|Width of the column. Note: can't be smaller than the text in the header| |align|string|Text-alignment for the column| |headerBackground|string|Custom background color for the header in that column| |textColor|string|Text-color for the header of that column| |headerStyle|object|Style object for the header of that column.| |cellStyle|object|Style object for every td in that column| |component|function|A custom component can be returned from this function. The function itself receives the rowData as argument|

Example for using custom components

  const data = [
    { id: 1, avatar: 'https://source.unsplash.com/random' }
    { id: 2, avatar: 'https://source.unsplash.com/random' }
  ]

  const columns = [
    {
      headerFor: 'avatar',
      title: 'Avatar',
      component: (rowData) => {
        return rowData.avatar && (
          <img
            src={rowData.avatar}
            style={{width: '50px', height: '50px', borderRadius: '50%'}}
            alt="custom_component_avatar"
          />
        )
    }
    ...
  ]

Editing

There are 3 basic "editing" options: adding, removing, and editing the table rows. You can turn this option on by passing editable prop to the Table component, and also an editComponents object, which defines the behaviour and the component for the specific buttons. Keep in mind, that component is optional, but passing in a callBack is required.

const editComponents = {
  onEdit: {
    component: <WhateverCustomButtonOrIcon />,
    callBack: (rowData) => {
      // Talk to the backend here maybe.
    };
  },
  onDelete: {
    component: <WhateverCustomButtonOrIcon />,
    callBack: (rowData) => {
      // Talk to the backend here maybe.
    };
  },
  onAdd: {
    component: <WhateverCustomButtonOrIcon />,
      callBack: (rowData) => {
        // Talk to the backend here maybe.
      };
  }
};

// And later when you call the Table component:
<Table columns={columns} data={data} editable editComponents={editComponents} />

Note: Each one of these editing options are optional, you can have either one, or all of them as you wish.