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

gf-react-datatables

v0.0.12

Published

A lightweight and customizable React data table component with sorting, searching, and pagination features.

Readme

DataTable Component

A flexible and customizable DataTable component built with React. It allows sorting, filtering, and pagination of data in a table format.

Features

  • Sorting: Sort data by clicking on column headers.
  • Filtering: Filter rows by typing in a search input.
  • Pagination: Navigate through the rows using previous and next buttons.
  • Customizable Rows per Page: Set the number of rows per page.
  • Responsive: Can be styled to work in any design system.

Installation

To install the DataTable component, run the following command in your React project:

npm install gf-react-datatables

or using Yarn:

yarn add gf-react-datatables

Prerequisites :

Before using this package, ensure your development environment meets the following requirements:

  • Node.js: v16 or later
  • React: v18 or later
  • NPM: v8+ (or Yarn v1.22+)
  • Recommended editor: VS Code (with ESLint & Prettier extensions for formatting)

Props

| Prop | Type | Default | Description | |----------------|------------------|---------------|--------------------------------------------------------------------------| | data | Array | - | An array of objects representing the rows of the table. | | columns | Array | - | An array of strings representing the columns to display in the table. | | rowsPerPage | Number | 3 | Number of rows to display per page. |

Usage

import React, { useState } from 'react';
import DataTable from 'gf-react-datatables';

const columns = ['firstName', 'lastName', 'startDate', 'department', 'dateOfBirth'];

const data = [
  { firstName: 'Alice', lastName: 'Johnson', startDate: '2023-01-01', department: 'Sales', dateOfBirth: '1990-01-01' },
  { firstName: 'Bob', lastName: 'Smith', startDate: '2023-02-15', department: 'Engineering', dateOfBirth: '1985-05-12' },
  { firstName: 'James', lastName: 'Doe', startDate: '2022-01-01', department: 'Engineering', dateOfBirth: '1988-04-12' },
  { firstName: 'Sarah', lastName: 'Connor', startDate: '2023-03-10', department: 'HR', dateOfBirth: '1990-02-25' },
  // more rows...
];

function App() {
  return <DataTable data={data} columns={columns} rowsPerPage={5} />;
}

export default App;

Sorting, Filtering, and Pagination

  • Sorting: Click on any column header to sort the data. Click again to toggle between ascending and descending order.
  • Filtering: Use the search input above the table to filter rows based on any column value.
  • Pagination: Navigate between pages using the "Prev" and "Next" buttons at the bottom of the table.

Custom Styling

The DataTable component comes with default styles that can be customized via CSS. You can override or extend the existing styles in your project.

Example:

.table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background-color: #f5f5f5;
  padding: 10px;
  cursor: pointer;
}

td {
  padding: 10px;
  border: 1px solid #ddd;
}

Contributing

Feel free to open issues and submit pull requests if you'd like to contribute to this project. Please make sure to follow the coding style used in the repository and write tests for new features.

License

MIT License

Links

  • GitHub Repository: https://github.com/gflahaut/react-datatables
  • NPM Package: https://www.npmjs.com/package/gf-react-datatables?activeTab=readme