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-grid-preference-engine

v1.0.0

Published

An enterprise-grade, highly customizable React Data Grid engine that focuses on **preference management**. It decouples UI from state, automatically saves grid layouts per-user (column visibility, sorting, etc.), and supports dynamic schema migrations.

Readme

React Grid Preference Engine

An enterprise-grade, highly customizable React Data Grid engine that focuses on preference management. It decouples UI from state, automatically saves grid layouts per-user (column visibility, sorting, etc.), and supports dynamic schema migrations.

Features

  • Storage Agnostic: Plug in LocalStorage, Cookies, or a custom API backend.
  • Multi-User Scoping: Preferences are saved using userId::gridKey.
  • Dynamic Columns inference: Automatically infers column headers directly from your raw JSON data if you prefer not to configure them manually.
  • Tailwind Ready: Fully customizable via classNames prop, allowing you to build completely headless-like designs.
  • Schema Migrations: Built-in migration pipeline to upgrade user preferences when you push a new app version.

Installation

npm install react-grid-preference-engine lucide-react

Quick Start

1. Wrap your App with the Provider

The provider controls the storage engine and current active user.

import { GridPreferenceProvider, LocalStorageProvider } from 'react-grid-preference-engine';

function App() {
  return (
    <GridPreferenceProvider 
      initialUserId="user-123" 
      config={{ storageProvider: new LocalStorageProvider() }}
    >
      <Dashboard />
    </GridPreferenceProvider>
  );
}

2. Render a Data Grid

You can provide explicit columns, or omit them to let the engine auto-infer columns from your data.

With Explicit Columns

import { DataGrid } from 'react-grid-preference-engine';
import 'react-grid-preference-engine/style.css'; // Optional: Use base styles

const columns = [
  { id: 'id', label: 'Order ID' },
  { id: 'status', label: 'Status' }
];

const data = [
  { id: 1, status: 'Open' },
  { id: 2, status: 'Closed' }
];

function Dashboard() {
  return <DataGrid gridKey="orders-grid" title="Orders" columns={columns} data={data} />;
}

With Dynamic Auto-Inference

If you don't pass columns, the grid automatically builds them from your data keys (e.g., emailAddress becomes "Email Address").

const apiResponse = [
  { userId: 1, emailAddress: '[email protected]', role: 'admin' },
  { userId: 2, emailAddress: '[email protected]', role: 'user' }
];

function Users() {
  return <DataGrid gridKey="users-grid" title="System Users" data={apiResponse} />;
}

Styling & Customization

The grid is built to be customized. You can either use our default CSS variables, or pass your own Tailwind classes to every element using the classNames prop.

Using CSS Variables

Import the base CSS and override the variables globally:

@import 'react-grid-preference-engine/style.css';

:root {
  --gpe-bg-surface: #0b0c10;
  --gpe-border-color: rgba(255, 255, 255, 0.1);
  --gpe-text-main: #e8e9eb;
  --gpe-primary: #66fcf1;
}

Using Tailwind CSS

Completely bypass the default look by injecting Tailwind utility classes:

<DataGrid 
  gridKey="custom-tailwind-grid" 
  title="Tailwind Data" 
  data={data} 
  classNames={{
    container: "bg-gray-900 border border-gray-700 rounded-xl p-6 text-white shadow-xl",
    header: "flex justify-between items-center mb-4",
    title: "text-xl font-bold text-blue-400",
    button: "px-4 py-2 rounded-lg bg-gray-800 hover:bg-gray-700 border border-gray-600 transition",
    primaryButton: "px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-500 text-white font-medium",
    tableWrapper: "overflow-x-auto rounded-lg border border-gray-700",
    table: "min-w-full divide-y divide-gray-700",
    th: "px-6 py-3 bg-gray-800 text-left text-xs font-medium text-gray-400 uppercase tracking-wider sticky top-0",
    td: "px-6 py-4 whitespace-nowrap text-sm text-gray-300 border-b border-gray-700",
    tr: "hover:bg-gray-800/50 transition-colors"
  }}
/>

Advanced Architecture

The Custom Hook

If you want to build a completely bespoke UI from scratch, use our headless hook:

import { useGridPreferences } from 'react-grid-preference-engine';

const { 
  preferences, 
  updateVisibleColumns, 
  updateSorting 
} = useGridPreferences('my-grid');

console.log(preferences.columnVisibility);

Custom Storage Providers

Implement the StorageProvider interface to sync preferences to your backend API:

import { StorageProvider } from 'react-grid-preference-engine';

export class ApiStorageProvider implements StorageProvider {
  async get(key: string) {
    const res = await fetch(`/api/preferences/${key}`);
    return res.text();
  }
  
  async set(key: string, value: string) {
    await fetch(`/api/preferences/${key}`, { method: 'POST', body: value });
  }
  
  async remove(key: string) {
    await fetch(`/api/preferences/${key}`, { method: 'DELETE' });
  }
}