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

react-ab-table

v1.2.1

Published

React component for building tables

Readme

react-ab-table

NPM JavaScript Style Guide

React-ab-table is a react component for creating tables. It has the following features:

  • Pagination
  • Sorting (hold shift for multisort)
  • Row selection (hold ctrl or shift to select multiple rows)
  • CSV data export
  • Sticky toolbar
  • Easy custom styling

It is very fast and lightweight, about 600 lines of code and no devependencies.

Live example is published on github.io.

React-ab-form is a part of AB-APP:rocket: boilerplate for creating serverless apps in AWS. AB-APP includes backend logic for tables, but you can use react-ab-form just as a separate component in your own application. Have fun! :tada:

Component properties

conf

[Object] Contains general configuration.

conf.rowsPerPage

[Integer, default = 15] Number of rows rendered per page.

conf.selectable

[Boolean, default = false] Whether rows can be selected or not.

conf.className

[String] Name of a custom class. This custom class is put on top of default table styles, so all custom styles override default. For example to make headers' text green, you should set your custom class: className = "CustomTable". Then write the following CSS in the .css file of your component, where you use react-ab-table:

.CustomForm th {
    color: green;
}

conf.csvExport

[Boolean, default = false] Whether table can be exported as csv-file.

conf.emptyTableMessage

[String, default = 'No data specified'] Message when table is empty.

cols

[Array of objects] Each table column is an object that describes column properties.

cols[i].name

[String] Column name, must have corresponding data in rows objects (see below).

cols[i].title

[String] Column title.

cols[i].sortOrder

[Integer] Default column sort priority.

cols[i].sortDirection

[String, default = 'ASC', possible values: 'ASC', 'DESC'] Default column sort direction.

cols[i].frontendFormatter

[Function | Function as a string] Formatter function. If it is provided, field value is calculated on the fly while page is rendering. Formatter function is executed for eact column field of the rows that are rendered for the current page. This function receives two parameters: column and row. Function must return the value to be put in table field.

For example formatter function can be used to build links

...
frontendFormatter: (col, row) => `<a href="/something/${row.id}">${row[col.name]}</a>`;
...

rows

[Array of objects] Each table row is an object that holds the data of the table. Object properties must be the same as names of cols objects.

...
{ 
    name: 'Buddy', 
    class: 'Dog', 
    age: 3, 
    gender: 'male' 
},
...

Install

npm install --save react-ab-table

Usage

import React, { Component } from 'react';

import AbTable from 'react-ab-table';

export default class App extends Component {
    render() {

        const conf = {
            selectable: true
        }

        const cols = [
            { name: 'name', title: 'Pet name' },
            { name: 'class', title: 'Animal class' },
            { name: 'age', title: 'Age' },
            { name: 'gender', title: 'Gender' }
        ]

        const rows = [
            { name: 'Buddy', class: 'Dog', age: 3, gender: 'male' },
            { name: 'Molly', class: 'Cat', age: 5, gender: 'female' },
            { name: 'Bonnie', class: 'Cat', age: 2, gender: 'female' },
            { name: 'Coco', class: 'Parrot', age: 22, gender: 'male' },
            { name: 'Oscar', class: 'Dog', age: 5, gender: 'male' },
            { name: 'Max', class: 'Turtle', age: 15, gender: 'male' },
            { name: 'Jack', class: 'Varan', age: 1, gender: 'male' }
        ]

        return (
            <div
                className="TableContainer" >
                <AbTable
                    data={{ conf, cols, rows }} />
            </div>
        )
    }
}

License

MIT © gnemtsov