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

@liji-table/react

v0.0.2

Published

A **headless, high-performance React table hook** built on top of `@liji-table/core`. It provides all advanced table logic — sorting, filtering, pagination, resizing, selection, export, and pinning — while leaving **full UI control to the developer**.

Readme

@liji-table/react

A headless, high-performance React table hook built on top of @liji-table/core.
It provides all advanced table logic — sorting, filtering, pagination, resizing, selection, export, and pinning — while leaving full UI control to the developer.

Logic handled. UI owned by you.


📌 Why @liji-table/react?

Most table libraries tightly couple logic + UI, making customization difficult and performance unpredictable.

@liji-table/react solves this by:

  • Running all logic in a core engine
  • Exposing React-friendly hooks
  • Allowing any UI framework or design system

This makes it ideal for dashboards, admin panels, analytics apps, and enterprise software.


🧱 Architecture Overview

Your UI (React JSX) ↓ useUniversalTable() ↓ @liji-table/core (Framework-agnostic engine)

  • @liji-table/react → React lifecycle & event bindings
  • @liji-table/core → Sorting, filtering, pagination, state, performance
  • Zero DOM assumptions
  • Zero CSS coupling

✨ Key Features Explained

⚙️ Headless Design

You write the <table>, <thead>, <tbody>, or even <div>-based layouts.
The hook only provides data + actions.


🔄 Sorting

  • Toggle ascending / descending / none
  • Programmatic control
  • Works on strings, numbers, booleans

🔍 Filtering & Search

  • Column-level filtering
  • Global search across all visible columns
  • Case-insensitive by default

📄 Pagination

  • Page index & page size control
  • Automatic total page calculation
  • Safe boundary handling

↔️ Column Resizing (High Performance)

  • Uses direct DOM manipulation during drag
  • React state updates only on mouse release
  • No re-render lag

🧩 Column Reordering

  • Native drag & drop support
  • Disabled automatically while resizing
  • State preserved across data updates

🧲 Column Pinning

  • Pin columns left or right
  • Useful for checkboxes, IDs, or actions

✅ Row Selection

  • Per-row selection
  • Select all rows on current page
  • Useful for bulk actions

📤 Export

  • Export filtered data
  • Download CSV instantly
  • No external dependency

📦 Installation

npm install @liji-table/react @liji-table/core

🚀 Basic Example

import { useUniversalTable } from "@liji-table/react";

const columns = [
  { id: "name", header: "Name", sortable: true },
  { id: "email", header: "Email" },
  { id: "sales", header: "Sales", sortable: true }
];

export default function Example({ data }) {
  const table = useUniversalTable(data, columns);

  return (
    <table>
      <thead>
        <tr>
          {table.visibleColumns.map((col, index) => (
            <th
              key={col.id}
              {...table.getHeaderProps(index, col.id)}
              style={{ width: table.state.columnWidths[col.id] }}
            >
              {col.header}
              <span {...table.getResizerProps(col.id)} />
            </th>
          ))}
        </tr>
      </thead>

      <tbody>
        {table.rows.map(row => (
          <tr key={row.id}>
            {table.visibleColumns.map(col => (
              <td key={col.id}>{row[col.id]}</td>
            ))}
          </tr>
        ))}
      </tbody>
    </table>
  );
}

🧠 Hook Return Values

📊 State & Data

| Property | Description | |--------|------------| | state | Full table state snapshot | | rows | Current page rows | | totalPages | Total page count | | allColumns | All columns | | visibleColumns | Columns not hidden | | selectedIds | Selected row IDs |


🛠 Actions API

🔍 Search & Filter

setSearch(query)
setFilter(columnId, value)

🔄 Sorting

toggleSort(columnId)
setSortDirection(columnId, direction)

📄 Pagination

setPage(pageIndex)
setPageSize(size)
nextPage()
prevPage()

🧩 Column Controls

toggleVisibility(columnId)
setColumnAlign(columnId, align)
pinColumn(columnId, 'left' | 'right' | null)
autoResizeAllColumns()

📤 Export

exportData()
downloadCSV("export.csv")

🎛 UI Helper Functions

These helpers are designed to be attached directly to DOM elements.

getHeaderProps(index, columnId)
getResizerProps(columnId)
isResizing

⚡ Performance Guarantees

  • Core initialized once
  • No state loss when data changes
  • Resize does not trigger React renders
  • Optimized for large datasets

🧩 When to Use This Library

✅ Recommended

  • Admin dashboards
  • Analytics tools
  • Enterprise software
  • Custom design systems

❌ Not Recommended

  • If you want a pre-styled table
  • If you don’t need advanced features