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

react-feature-table

v0.1.0

Published

A lightweight, flexible, and fully configurable React data table with toggleable sorting, search, and pagination.

Readme

react-feature-table 🚀

npm version License: MIT TypeScript React

A lightweight, flexible, and fully configurable React data table component with toggleable sorting, search, and pagination. Built with TypeScript and zero external runtime dependencies.


✨ Features

  • ⚡ Lightweight & Fast: Zero runtime dependencies (only React as peer dependency).
  • 🔍 Instant Search: Fast, case-insensitive global fuzzy search across any or all columns.
  • ⇅ Multi-Type Sorting: Sort numbers, strings, and custom values in ascending or descending order.
  • 📄 Smart Pagination: Customizable page size with total entries calculation and navigation buttons.
  • 🎨 Custom Cell Renderers: Render custom badges, images, action buttons, or interactive components with ease.
  • 🎛️ Headless Hook (useFeatureTable): Exported React hook for building custom table layouts or card grids.
  • 💅 Styling Ready: Includes clean modern styles with optional zebra striping, row hover highlights, and sticky header.
  • 🛡️ Fully Typed: 100% written in TypeScript with full generics support.

📦 Installation

npm install react-feature-table
yarn add react-feature-table
pnpm add react-feature-table

🚀 Quick Start

Import the component and its stylesheet:

import React from 'react';
import { FeatureTable, Column } from 'react-feature-table';
import 'react-feature-table/styles.css';

interface User {
  id: number;
  name: string;
  role: string;
  salary: number;
}

const data: User[] = [
  { id: 1, name: 'Sarah Connor', role: 'Lead Architect', salary: 140000 },
  { id: 2, name: 'Alex Vance', role: 'Quantum Physicist', salary: 135000 },
  { id: 3, name: 'David Bowman', role: 'Mission Commander', salary: 125000 },
];

const columns: Column<User>[] = [
  { key: 'name', title: 'Full Name', sortable: true, searchable: true },
  { key: 'role', title: 'Role', sortable: true, searchable: true },
  {
    key: 'salary',
    title: 'Salary',
    sortable: true,
    align: 'right',
    render: (value) => `$${Number(value).toLocaleString()}`,
  },
];

export function App() {
  return (
    <FeatureTable<User>
      data={data}
      columns={columns}
      rowKey="id"
      sortable
      searchable
      pagination={{ pageSize: 5 }}
      striped
      hoverable
      onRowClick={(row) => console.log('Row clicked:', row)}
    />
  );
}

📖 Component API

<FeatureTable<T> /> Props

| Prop | Type | Default | Description | | :--- | :--- | :--- | :--- | | data | T[] | Required | The array of data records to display. | | columns | Column<T>[] | Required | Column definitions. | | rowKey | keyof T \| ((row: T) => string \| number) | undefined | Unique row identifier (defaults to array index). | | sortable | boolean | true | Enables or disables header sorting globally. | | searchable | boolean | true | Enables or disables the search toolbar input. | | pagination | boolean \| PaginationOptions | true | Enables pagination or passes custom pagination options. | | striped | boolean | true | Adds alternating zebra background stripes to rows. | | hoverable | boolean | true | Highlights table rows on hover. | | stickyHeader | boolean | false | Fixes the table header to the top during vertical scroll. | | emptyText | string | 'No data available' | Custom message displayed when dataset is empty. | | className | string | '' | Custom CSS class name for the outer container. | | style | React.CSSProperties | undefined | Custom inline styles for the outer container. | | onRowClick | (row: T, index: number) => void | undefined | Callback fired when a table row is clicked. |


Column Configuration (Column<T>)

| Property | Type | Default | Description | | :--- | :--- | :--- | :--- | | key | keyof T \| string | Required | Object key corresponding to the data property. | | title | string | Required | Header text displayed for the column. | | sortable | boolean | true | Enable or disable sorting on this specific column. | | searchable | boolean | true | Include or exclude this column from global search filtering. | | render | (value: any, row: T, index: number) => ReactNode | undefined | Custom cell renderer function. | | width | string \| number | undefined | Column width (e.g., '180px', '20%'). | | align | 'left' \| 'center' \| 'right' | 'left' | Text alignment for header and cells. | | sticky | 'left' \| 'right' | undefined | Make column fixed to the left or right. |


Pagination Options (PaginationOptions)

interface PaginationOptions {
  pageSize?: number;        // Number of items per page (default: 10)
  pageSizeOptions?: number[]; // Available page sizes
  showTotal?: boolean;      // Show "Showing X of Y entries" text (default: true)
}

🪝 Headless Hook: useFeatureTable

If you want complete control over your markup or want to render cards instead of an HTML table, use the headless hook:

import { useFeatureTable } from 'react-feature-table';

function CustomCardView({ users, columns }) {
  const {
    searchTerm,
    setSearchTerm,
    paginatedData,
    currentPage,
    setCurrentPage,
    totalPages,
    totalItems,
    handleSort,
  } = useFeatureTable({
    data: users,
    columns,
    pageSize: 8,
  });

  return (
    <div>
      <input
        value={searchTerm}
        onChange={(e) => setSearchTerm(e.target.value)}
        placeholder="Search..."
      />

      <div className="grid">
        {paginatedData.map((user) => (
          <div key={user.id} className="card">
            <h3>{user.name}</h3>
            <p>{user.role}</p>
          </div>
        ))}
      </div>

      <button disabled={currentPage <= 1} onClick={() => setCurrentPage(currentPage - 1)}>
        Previous
      </button>
      <span>Page {currentPage} of {totalPages}</span>
      <button disabled={currentPage >= totalPages} onClick={() => setCurrentPage(currentPage + 1)}>
        Next
      </button>
    </div>
  );
}

💻 Running the Demo App

The repository includes a full interactive demo application testing all features with mock JSON datasets:

# From repository root
npm run demo

Or run directly:

cd demo-app
npm install
npm run dev

Visit http://localhost:5174 to explore the live playground with feature toggles, modal inspectors, and dataset switchers.


🛠️ Building & Packaging

# Build TypeScript and bundle via tsup
npm run build

# Create distribution tarball
npm pack

📄 License

MIT © Abhishek Bhatt