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

@litforge/data-table

v0.1.3

Published

A comprehensive data table component with sorting, pagination, search, and selection, built with Lit.

Readme

@litforge/data-table

A comprehensive data table component with sorting, pagination, search, and selection, built with Lit.

Overview

The DataTable component provides a full-featured table with:

  • Column sorting
  • Pagination
  • Search/filtering
  • Row selection
  • Loading states
  • Empty states
  • Customizable toolbar

Installation

npm install @litforge/data-table
# or
pnpm add @litforge/data-table
# or
yarn add @litforge/data-table

Basic Usage

<script type="module">
  import '@litforge/data-table';
</script>

<data-table
  columns="${columns}"
  rows="${rows}"
  sortable
  pagination
  @table-sort="${handleSort}"
></data-table>

Properties

| Property | Type | Default | Description | |----------|------|---------|-------------| | columns | TableColumn[] | undefined | Column definitions | | rows | TableRowData[] | undefined | Table row data | | selectable | boolean | false | Enables row selection | | sortBy | string | undefined | Currently sorted column | | sortDirection | 'asc' \| 'desc' | undefined | Sort direction | | loading | boolean | false | Shows loading state | | emptyMessage | string | undefined | Message when no data | | showToolbar | boolean | false | Shows toolbar | | showPagination | boolean | false | Shows pagination | | searchable | boolean | false | Enables search | | toolbarTitle | string | undefined | Toolbar title | | toolbarDescription | string | undefined | Toolbar description | | page | number | undefined | Current page number | | pageSize | number | undefined | Items per page | | totalItems | number | undefined | Total items count | | pageSizeOptions | number[] | undefined | Page size options | | selected | Set<string> | undefined | Selected row IDs |

Events

table-sort

Fired when a column is sorted.

interface TableSortDetail {
  column: string;
  direction: 'asc' | 'desc';
}

table-row-select

Fired when a row is selected/deselected.

interface TableRowSelectDetail {
  rowId: string;
  selected: boolean;
}

table-page-change

Fired when page changes.

interface TablePageChangeDetail {
  page: number;
}

table-page-size-change

Fired when page size changes.

interface TablePageSizeChangeDetail {
  pageSize: number;
}

table-search

Fired when search query changes.

interface TableSearchDetail {
  query: string;
}

Examples

Basic Table

<data-table
  columns="${columns}"
  rows="${rows}"
></data-table>

With Sorting and Pagination

<data-table
  columns="${columns}"
  rows="${rows}"
  sortable
  showPagination
  page="${currentPage}"
  pageSize="${pageSize}"
  totalItems="${total}"
  @table-sort="${handleSort}"
  @table-page-change="${handlePageChange}"
></data-table>

With Search and Selection

<data-table
  columns="${columns}"
  rows="${rows}"
  selectable
  searchable
  showToolbar
  toolbarTitle="Users"
  @table-search="${handleSearch}"
  @table-row-select="${handleRowSelect}"
></data-table>

TypeScript

import { DataTable } from '@litforge/data-table';
import type {
  TableColumn,
  TableRowData,
  TableSortDetail,
  TableSortDirection
} from '@litforge/data-table';

const columns: TableColumn[] = [
  { id: 'name', label: 'Name', sortable: true },
  { id: 'email', label: 'Email', sortable: true }
];

Styling

The component uses CSS variables for theming:

data-table {
  --lf-data-table-font-family: 'Inter', sans-serif;
  --lf-data-table-border-color: #e2e8f0;
  --lf-data-table-header-background: #f8fafc;
  /* ... more variables */
}

License

Part of the LitForge component library.