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

js-table-grid

v1.0.6

Published

JS Table Grid is a lightweight and customizable data table library built with vanilla JavaScript. It provides features such as pagination, filtering, sorting, and printing, making it easy to display and manage tabular data.

Readme

JS Table Grid

JS Table Grid is a lightweight and customizable data table library built with vanilla JavaScript. It provides features such as pagination, filtering, sorting, and printing, making it easy to display and manage tabular data.

Features

  • Pagination
  • Filtering
  • Sorting by columns
  • Print table functionality
  • Lightweight and dependency-free
  • Customizable styling

Installation

Install the package using npm:

npm install js-table-grid

Usage

Basic Example

Here is an example of how to use JS Table Grid in your project:

HTML

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>JS Table Grid Example</title>
</head>
<body>
  <div>
    <input class="js-search" type="text" placeholder="Search...">
    <button class="js-sort-name">Sort by Name</button>
  </div>

  <div class="js-table-container"></div>
  <div class="js-pagination"></div>

  <script type="module" src="./main.js"></script>
</body>
</html>

JavaScript

Create a main.js file in the root of your project:

import { JsTable } from 'js-table-grid';
import 'js-table-grid/css';

// Sample data
const data = [
  { id: 1, name: 'John Doe', age: 28 },
  { id: 2, name: 'Jane Smith', age: 34 },
  { id: 3, name: 'Sam Johnson', age: 22 },
  { id: 4, name: 'Lisa Adams', age: 30 },
];

const columns = ['id', 'name', 'age'];
const table = new JsTable(data, columns);

// Search functionality
document.querySelector('.js-search').addEventListener('input', (e) => {
  table.search(e.target.value);
});

// Sorting functionality
document.querySelector('.js-sort-name').addEventListener('click', () => {
  table.sortData('name', 'asc');
});

Styles

Make sure you include the CSS file for basic styling. If you are using a bundler like Vite, you can import the CSS directly as shown above.

API

JsTable

Constructor

const table = new JsTable(data, columns);
  • data: An array of objects representing the table rows.
  • columns: An array of strings representing the column names.

Methods

  • search(query: string): void

    • Filters the table data based on the query.
  • sortData(column: string, direction: 'asc' | 'desc'): void

    • Sorts the table data by the specified column in the given direction.
  • printTable(): void

    • Opens a print dialog with the current table content.

Development

To test or modify the package locally:

  1. Clone the repository:

    git clone https://github.com/HasanHafizurRahman/js-table-grid.git
    cd js-table-grid
  2. Install dependencies:

    npm install
  3. Build the project:

    npm run build
  4. Run a development server (e.g., Vite):

    npm run dev

Contributing

Contributions are welcome! Feel free to submit issues or pull requests on the GitHub repository.

License

This project is licensed under the ISC License.

Author

Hasan Hafizur Rahman