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

@czkoudy/data-table

v1.2.0

Published

A React data table component with pagination, sorting, and filtering capabilities.

Downloads

96

Readme

@czkoudy/data-table

A fully-featured, headless, and highly customizable React data table component built with @tanstack/react-table and styled using Tailwind CSS. Supports sorting, filtering, grouping, pagination, row selection, and more.

Features

  • 🧩 TypeScript support
  • 🎨 Tailwind CSS styling (no external CSS required)
  • 🔍 Column and global filtering
  • ↕️ Sorting
  • 📊 Grouping
  • Pagination
  • Row selection
  • 🕹️ Imperative API (clear selection)
  • 🗂️ Custom cell rendering
  • 🏷️ Value label mapping
  • 🕒 Date formatting
  • Fast and lightweight

Installation

npm install @czkoudy/data-table @tanstack/react-table date-fns
# or
pnpm add @czkoudy/data-table @tanstack/react-table date-fns

Note: react, react-dom, @tanstack/react-table, and date-fns are peer dependencies.

Usage

import DataTable, { DataTableProps, DataTableRef } from '@czkoudy/data-table';

const columns = [
  {
    accessorKey: 'name',
    header: 'Name',
    meta: { align: 'left' },
  },
  {
    accessorKey: 'createdAt',
    header: 'Created At',
    meta: { type: 'date', align: 'center', fallback: 'N/A' },
  },
  {
    accessorKey: 'status',
    header: 'Status',
    meta: {
      valueLabelMap: {
        active: '🟢 Active',
        inactive: '🔴 Inactive',
        falsy: 'Unknown',
      },
      align: 'center',
    },
  },
];

const data = [
  { name: 'Alice', createdAt: '2024-06-01T10:00:00Z', status: 'active' },
  { name: 'Bob', createdAt: null, status: 'inactive' },
];

function App() {
  return (
    <DataTable
      columns={columns}
      data={data}
      enableSearch
      enableSorting
      enablePagination
      showRowSelectors
      pageSize={10}
      loading={false}
      onRowClick={(row) => alert(`Clicked: ${row.name}`)}
    />
  );
}

Props

See DataTableProps for full API.

| Prop | Type | Description | | ------------------ | -------------------------- | ----------------------------- | | columns | ColumnDef<T, any, any>[] | Table columns definition | | data | T[] | Table data | | enableSearch | boolean | Show global search input | | enableSorting | boolean | Enable sorting | | enablePagination | boolean | Enable pagination | | showRowSelectors | boolean | Show row selection checkboxes | | onRowClick | (row: T) => void | Row click handler | | ... | ... | See source for more options |

Column Meta

You can pass a meta object to each column for advanced features:

meta: {
  align: 'left' | 'center' | 'right',
  type: 'date', // enables date formatting
  fallback: '-', // fallback for invalid dates
  valueLabelMap: { [key: string]: string }, // custom value labels
  filterValueExcludeList: string[], // exclude values from filter
  filterValueIncludeList: string[], // include only these values in filter
  disableRowClick: boolean, // disables row click for this column
}

Imperative API

You can use a ref to clear row selection:

const tableRef = useRef<DataTableRef>(null);

<DataTable ref={tableRef} ... />

// Clear selection
tableRef.current?.clearSelection();

License

MIT

Contributing

PRs and issues welcome! See GitHub repo.