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

@utiltools/datagrid

v0.1.8

Published

A lightweight, TypeScript-first React data grid with sorting, filtering, pagination and row selection.

Readme

@utiltools/datagrid

npm version License: MIT

A lightweight, TypeScript-first React data grid with sorting, filtering, pagination and row selection.

✨ Features

  • ⚛️ React 18+ — Built for modern React applications
  • 🔒 TypeScript First — Complete type safety and IntelliSense
  • 📦 Lightweight — Minimal bundle size, no external dependencies
  • 🎨 Customizable — Easy to style and theme
  • ⚡ Performant — Handles large datasets efficiently
  • ♿ Accessible — Keyboard navigation and ARIA attributes
  • 📱 Responsive — Works on all screen sizes

📦 Installation

npm install @utiltools/datagrid
yarn add @utiltools/datagrid
pnpm add @utiltools/datagrid

🚀 Quick Start

import { DataGrid } from '@utiltools/datagrid';
import type { ColumnDef } from '@utiltools/datagrid';

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

const data: User[] = [
  { id: 1, name: 'Alice Johnson', email: '[email protected]', role: 'Admin' },
  { id: 2, name: 'Bob Smith', email: '[email protected]', role: 'User' },
  { id: 3, name: 'Charlie Brown', email: '[email protected]', role: 'Editor' },
];

const columns: ColumnDef<User>[] = [
  { key: 'name',  label: 'Name',  sortable: true, filterable: true },
  { key: 'email', label: 'Email', sortable: true },
  { key: 'role',  label: 'Role',  sortable: true },
];

function App() {
  return (
    <DataGrid
      data={data}
      columns={columns}
      rowKey="id"
      pageSize={10}
      searchable
    />
  );
}

🎯 Core Features

Column Definition (ColumnDef<T>)

interface ColumnDef<T> {
  key: keyof T & string;          // must match a property in your row objects
  label: string;                  // header text
  sortable?: boolean;             // enable sort on click (default: false)
  filterable?: boolean;           // show per-column filter input (default: false)
  width?: number;                 // fixed pixel width
  minWidth?: number;              // minimum width
  align?: 'left' | 'center' | 'right';
  render?: (value: unknown, row: T, rowIndex: number) => string; // HTML string renderer
  hidden?: boolean;               // exclude column from render
  pinned?: boolean;               // pin column to the left
}

Sorting

Click any column header marked sortable: true to cycle through ascending → descending → unsorted.

const columns: ColumnDef<User>[] = [
  { key: 'name', label: 'Name', sortable: true },
  { key: 'age',  label: 'Age',  sortable: true },
];

Filtering

Set filterable: true on any column to show a filter input beneath the column header. A global search box is also shown in the toolbar by default.

const columns: ColumnDef<User>[] = [
  { key: 'name',  label: 'Name',       sortable: true, filterable: true },
  { key: 'city',  label: 'City',       sortable: true, filterable: true },
  { key: 'salary', label: 'Salary',    sortable: true },
];

// Disable the global search box
<DataGrid data={data} columns={columns} rowKey="id" searchable={false} />

Pagination

<DataGrid
  data={data}
  columns={columns}
  rowKey="id"
  pageSize={25}
  pageSizeOptions={[10, 25, 50, 100]}
/>

Row Selection

import { useState } from 'react';

function MyGrid() {
  const [selected, setSelected] = useState<Set<string>>(new Set());

  return (
    <>
      <p>{selected.size} rows selected</p>
      <DataGrid
        data={data}
        columns={columns}
        rowKey="id"
        selectable
        onSelectionChange={setSelected}
      />
    </>
  );
}

Custom Cell Rendering

The render function returns an HTML string. Use it for badges, formatted values, etc.

const columns: ColumnDef<User>[] = [
  {
    key: 'status',
    label: 'Status',
    sortable: true,
    align: 'center',
    render: (value) => {
      const color = value === 'Active' ? 'green' : 'gray';
      return `<span style="color:${color};font-weight:600">${value}</span>`;
    },
  },
  {
    key: 'salary',
    label: 'Salary',
    sortable: true,
    align: 'right',
    render: (value) =>
      typeof value === 'number' ? `$${value.toLocaleString()}` : '—',
  },
];

Loading State

<DataGrid
  data={[]}
  columns={columns}
  rowKey="id"
  pageSize={10}
  loading
/>

Striped Rows

<DataGrid data={data} columns={columns} rowKey="id" striped />

📋 Props Reference

| Prop | Type | Default | Description | |------|------|---------|-------------| | data | TRow[] | required | Array of row objects | | columns | ColumnDef<TRow>[] | required | Column definitions | | rowKey | keyof TRow | index | Field used as unique row identifier | | pageSize | number | 10 | Initial rows per page | | pageSizeOptions | number[] | [10, 25, 50, 100] | Page size dropdown options | | selectable | boolean | false | Enable row selection checkboxes | | striped | boolean | false | Alternate row background colors | | searchable | boolean | true | Show global search input in toolbar | | searchPlaceholder | string | "Search…" | Global search input placeholder | | loading | boolean | false | Show skeleton loading state | | emptyMessage | string | "No data to display." | Message shown when data is empty | | className | string | "" | Additional CSS classes for the outer wrapper | | onSelectionChange | (keys: Set<string>) => void | — | Fired when selected rows change |

🔗 Related Packages

  • @utiltools/grid-core — framework-agnostic sorting, filtering, pagination and selection engine (used internally)

📚 Documentation

Full documentation, API reference, and interactive demos:

👉 developer.utiltools.org/docs/datagrid

🎮 Live Demo

👉 developer.utiltools.org/demos/datagrid

📄 License

MIT © Fatih Sevim

🤝 Contributing

Contributions, issues and feature requests are welcome!

See GitHub repository for more information.


Made with ❤️ by the UtilTools team