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

@lp-labs/react-data-table

v0.1.0

Published

Accessible React tables with sorting, filtering, pagination and selection.

Readme

@lp-labs/react-data-table

Semantic React tables with stable sorting, filtering, pagination and selection. React 18+ is the only runtime peer. Includes TypeScript, ESM, CommonJS and browser entries. No CSS import required.

Installation

npm install @lp-labs/react-data-table

Requires React 18 or later in the host application. Server-side rendering is supported. Node.js consumers require Node.js 18 or later.

Quick Start

import DataTable from '@lp-labs/react-data-table';

const rows = [
  { id: 'keyboard', name: 'Keyboard', price: 49 },
  { id: 'mouse', name: 'Mouse', price: 25 },
];

const columns = [
  { id: 'name', header: 'Name' },
  { id: 'price', header: 'Price', cell: (value) => `$${Number(value).toFixed(2)}` },
];

export default function Example() {
  return (
    <DataTable
      data={rows}
      columns={columns}
      caption="Products"
      pageSize={20}
      selectionMode="multiple"
    />
  );
}

Columns

Column options: unique id, header, accessor (property or function), cell(value,row), compare(a,b,rowA,rowB), sortable and searchable (default true), filter(value,query,row), and width. The pure getTableRows helper performs stable sorting and filtering without mutating input. getCellValue is also exported.

Without an accessor, a column reads row[column.id]. Use cell for display formatting and accessor for the underlying value used by sorting and filtering.

DataTable API

| Prop | Default | Description | | --- | --- | --- | | data | [] | Row data | | columns | [] | Column definitions with unique IDs | | getRowId(row, index) | row.id ?? index | Stable row identifier | | sort / defaultSort | null | { id, direction: 'asc' \| 'desc' } | | query / defaultQuery | '' | Global search text | | filters | {} | Per-column filter values keyed by column ID | | page / defaultPage | 0 | Zero-based page index | | pageSize | 10 | Maximum rows per page | | selectionMode | 'none' | 'none', 'single', or 'multiple' | | selectedIds / defaultSelectedIds | [] | Selected row IDs | | showSearch | true | Show the built-in search field | | caption | none | Native table caption | | emptyContent | 'No rows' | Empty-result content |

Callbacks are onSortChange(sort), onQueryChange(query), onPageChange(page), onSelectionChange(ids), and onRowClick(row). Standard wrapper div attributes and styles are supported. Apply the corresponding callback when supplying a controlled value; default* props initialize internal state only.

Sorting And Filtering

Global search uses query/defaultQuery and onQueryChange; showSearch defaults true. Pass filters keyed by column id for per-column filters, supplying your own filter controls. Search is case-insensitive substring matching by default. Sorting uses sort/defaultSort with {id,direction:'asc'|'desc'} and onSortChange; clicking a column alternates ascending/descending. Native table headings expose sort state.

Pagination And Selection

Pagination uses zero-based page/defaultPage, pageSize (default 10), and onPageChange. Invalid page sizes throw; pages beyond filtered data are clamped for display. Search and sort interactions request page 0. Controlled props require applying their corresponding callbacks.

selectionMode is none (default), single, or multiple. Use selectedIds/defaultSelectedIds and onSelectionChange; the header checkbox selects only the current page and preserves off-page selections. IDs come from getRowId(row,index) or row.id ?? index; provide stable unique IDs for changing data. Selection ignores IDs absent from data. No hierarchical cascade or shift-range selection is included.

Compatibility And Limits

Put custom interactive cell controls in cell renderers for keyboard-accessible row actions; onRowClick alone is not a keyboard action. Table contents are not virtualized: pagination bounds displayed rows, but sorting/filtering process the full data array in memory. Server-side pagination, column dragging/resizing, CSV export and variable-height virtualization are not included. SSR and React Server Component client boundaries are supported.

Support

Support maintenance with a PayPal donation.

Author

Created by Libin Prasanth.