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

@domphy/table

v0.19.1

Published

Domphy Table - headless table logic, a 1-1 port of @tanstack/table-core

Readme

@domphy/table

domphy.com · Docs · npm

Headless table logic for Domphy apps: sorting, filtering, pagination, row selection, grouping, expanding, column pinning, sizing, visibility, and faceting. Domphy owns the rendering — this package owns the table state.

Install

npm install @domphy/table

@domphy/core is a peer dependency.

Quick start — createDomphyTable

Import from the /domphy subpath to get a reactive handle that Domphy elements subscribe to:

import { createDomphyTable } from "@domphy/table/domphy"
import { createColumnHelper, getCoreRowModel, getSortedRowModel } from "@domphy/table"

const columnHelper = createColumnHelper<Person>()
const columns = [
  columnHelper.accessor("name", { header: "Name" }),
  columnHelper.accessor("age", { header: "Age" }),
]

const dTable = createDomphyTable({
  data: people,
  columns,
  getCoreRowModel: getCoreRowModel(),
  getSortedRowModel: getSortedRowModel(),
})

Render with version(l) for coarse re-renders (whole table) or pass l directly to fine-grained reads:

// Coarse — re-render tbody when any table state changes
const App = {
  tbody: (l) => {
    dTable.version(l)
    return dTable.table.getRowModel().rows.map((row) => ({
      tr: row.getVisibleCells().map((cell) => ({
        td: String(cell.getValue() ?? ""),
        _key: cell.id,
      })),
      _key: row.id,
    }))
  },
}

// Fine-grained — only this button re-renders when page changes
const PrevButton = {
  button: "Previous",
  disabled: (l) => !dTable.getCanPreviousPage(l),
  onClick: () => dTable.table.previousPage(),
}

DomphyTable handle

createDomphyTable(options) returns a DomphyTable<TData> handle:

| Method | Description | |---|---| | table | Raw table-core Table instance — all feature methods (setSorting, setColumnFilters, nextPage, …) | | version(l?) | Reactive change counter — bumps on any state change | | state(l?) | Full TableState, reactive with listener | | setState(updater) | Direct state update | | destroy() | Releases reactive state | | getRowModel(l?) | Reactive row model | | getHeaderGroups(l?) | Reactive header groups | | getAllLeafColumns(l?) | All leaf columns, reactive | | getVisibleLeafColumns(l?) | Visible leaf columns, reactive | | getIsAllColumnsVisible(l?) | Reactive | | getIsSomeColumnsVisible(l?) | Reactive | | getSelectedRowModel(l?) | Reactive selected rows | | getIsAllRowsSelected(l?) | Reactive | | getIsSomeRowsSelected(l?) | Reactive | | getIsAllRowsExpanded(l?) | Reactive | | getCanNextPage(l?) | Reactive | | getCanPreviousPage(l?) | Reactive | | getPageCount(l?) | Reactive |

Cell editing (opt-in)

CellEditing is a Domphy-original feature (no TanStack counterpart) and is not part of the built-in feature list — pass it via _features to keep the core a byte-level port:

import { createDomphyTable } from "@domphy/table/domphy"
import { CellEditing, createColumnHelper, getCoreRowModel } from "@domphy/table"

const dTable = createDomphyTable({
  data: people,
  columns,
  getCoreRowModel: getCoreRowModel(),
  _features: [CellEditing],
  // Commit hook — write the value back into your own data here.
  onCellEdit: ({ rowId, columnId, value }) => updatePerson(rowId, columnId, value),
  // Gate editing per cell: boolean or (cell) => boolean (default true)
  // enableCellEditing: (cell) => cell.column.id !== "id",
})

State is cellEditing: { rowId, columnId } | null — one cell edits at a time. Cell methods: beginEdit(), commitEdit(value) (fires onCellEdit, then exits), cancelEdit() (exits silently), getIsEditing(), getCanEdit(). Table methods: setEditingCell, getEditingCell, resetEditingCell.

An editable <td> render — show an input while the cell is editing, commit on Enter/blur, cancel on Escape:

{
  td: (l) => {
    dTable.version(l)
    const cell = cellAt(row, columnId)
    return cell.getIsEditing()
      ? [{
          input: null,
          value: String(cell.getValue() ?? ""),
          onKeyDown: (e) => {
            if (e.key === "Enter") cell.commitEdit(e.target.value)
            if (e.key === "Escape") cell.cancelEdit()
          },
          onBlur: (e) => cell.commitEdit(e.target.value),
        }]
      : [String(cell.getValue() ?? "")]
  },
  onDblClick: () => cellAt(row, columnId).beginEdit(),
}

Raw table-core (advanced)

Import directly from @domphy/table for the raw TanStack table-core API:

import { createTable, getCoreRowModel, createColumnHelper } from "@domphy/table"

All TanStack Table v8 APIs are available unchanged.

What's included

  • createTable / createColumnHelper — table instance and typed column defs
  • Row models (opt-in, tree-shakeable): core, sorted, filtered, grouped, expanded, paginated, faceted
  • Built-in sortingFns, filterFns, aggregationFns
  • Per-feature APIs: column filtering, global filtering, sorting, pagination, row selection, expanding, grouping, column ordering/pinning/sizing/visibility, faceting

Documentation

License

MIT — see LICENSE.