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

vk-custom-tables

v0.1.8

Published

A npm package to easily create sortable and searchable data tables as a React component.

Downloads

6

Readme

Custom Tables

A npm package to easily create sortable and searchable data tables as a React component.

Prerequisite

To use it you need to have installed React and React-dom. It is recommended that you scaffold your React project with a tool like Create React App or ViteJs.

For information, the examples provided in the repository were bootstrapped using ViteJS

Installation

In your root folder, with a package.json file run the following command :

npm install vk-custom-tables

or with yarn :

yarn add vk-custom-tables

Usage

import {CustomTable} from "vk-custom-tables"
import "vk-custom-tables/dist/Styles/CustomTable.css" 

function YourComponent () {
    //your code
    return (
        //The rest of your JSX
        <CustomTable data={contentData} columns={columnsLabels} />
        //...
    )
}

You need to import both the component itself and the stylesheet.

Format of data

The CustomTable component take in two required props : data and columns. In order for the data to be displayed correctly, to be sortable and searchable it must be correctly formatted.

The columns prop indicate what will appear in the header and which key to look in the data elements. For instance :

const columnsLabels = [
    { title: 'First Name', label: 'firstName' },
    { title: 'Last Name', label: 'lastName' },
    { title: 'Start Date', label: 'startDate' },
    { title: 'Department', label: 'department' },
    { title: 'Date of Birth', label: 'dateOfBirth' },
    { title: 'Street', label: 'street' },
    { title: 'City', label: 'city' },
    { title: 'State', label: 'state' },
    { title: 'Zip Code', label: 'zipCode' }
]

Then your data props should be an array of objects with the keys specified in the label values of your column prop :

const contentData = [
    {
        firstName : "Marisa",
        lastName : "Kirisame",
        startDate : "09/08/2021",
        department : "Human Resources",
        dateOfBirth : "08/15/2007",
        street : "Kirisame Magic Shop",
        city : "Gensokyo",
        state : "AZ",
        zipCode : "58906"
    },
    {
        firstName : "Reimu",
        lastName : "Hakurei",
        startDate : "09/01/2021",
        department : "Sales",
        dateOfBirth : "09/12/2007",
        street : "Hakurei Shrine",
        city : "Gensokyo",
        state : "OH",
        zipCode : "12505"
    },
    {
        firstName : "Mokou",
        lastName : "Fujiwara no",
        startDate : "10/01/2020",
        department : "Engineering",
        dateOfBirth : "05/12/785",
        street : "Bamboo forest of the lost",
        city : "Gensokyo",
        state : "NC",
        zipCode : "90657"
    }
]

The value of each object in the data array should either be a string or a number. A string parseable as a date is also valid, and will be sorted accordingly.

And that's it, you should have your data displayed in a table.

Importing the data types

If your project is in TypeScript, you can import and use the types for the two CustomTable props :

import {CustomTable, ColumnsLabelItem, DataDefaultType} from "vk-custom-tables";

const columnsLabel : ColumnsLabelItem[] = {
    //...
}

const contentData : DataDefaultType[] = {
    //...
}

Side notes

As long as your data is consistent across all element, same format for each date, no missing data, using only strings and/or numbers, the table should work correctly : displaying, filtering and sorting.