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

go-mui-datagrid

v1.0.3

Published

React DataGrid component extended from MUI DataGridPro with extra features

Downloads

356

Readme

go-mui-datagrid

React DataGrid components built on MUI X Data Grid Pro and Data Grid Premium, with persistent state (local or session storage), resizable columns, and a unified ref API including getStoredData().


Table of contents


Installation

npm install go-mui-datagrid

With yarn or pnpm:

yarn add go-mui-datagrid

Note: MUI X Data Grid Pro and Premium require a license for production use (free for development).


Components

GoDataGridPro

Uses MUI Data Grid Pro. Supports all Pro features (tree data, row reorder, column pinning, etc.) plus state persistence and the extended ref.

import { GoDataGridPro } from 'go-mui-datagrid';
import { useGridApiRef } from '@mui/x-data-grid-pro';

const apiRef = useGridApiRef();
<GoDataGridPro
  apiRef={apiRef}
  id="my-grid"
  rows={rows}
  columns={columns}
  // ... any DataGridPro props
/>

GoDataGridPremium

Same as Pro but uses MUI Data Grid Premium, including Excel export, row grouping, and other Premium-only features.

import { GoDataGridPremium } from 'go-mui-datagrid';
import { useGridApiRef } from '@mui/x-data-grid-premium';

const apiRef = useGridApiRef();
<GoDataGridPremium
  apiRef={apiRef}
  id="my-grid"
  rows={rows}
  columns={columns}
  // ... any DataGridPremium props
/>

Props

Both components accept all props from the underlying MUI grid (DataGridProProps or DataGridPremiumProps) plus these extras:

| Prop | Type | Default | Description | | ------------------- | -------------------------------------------------------------------- | ------------------------------- | ----------- | | id | string | btoa(location.href) | Unique id used as (part of) the storage key. Recommended to avoid key clashes. | | storageStrategy | GoDataGridProStorageStrategy | GoDataGridPremiumStorageStrategy | LOCAL_STORAGE | Where to persist state: localStorage or sessionStorage. | | storageAttributes | GoDataGridProStorageAttribute[] | GoDataGridPremiumStorageAttribute[] | — (entire state) | If set, only these parts of the state are saved (e.g. ['filter', 'sorting', 'pagination']). | | keepState | boolean | true | If false, state is not saved to storage. | | resizable | boolean | false | If true, column separators are visible and columns are resizable. |

You can pass any other grid prop (e.g. rows, columns, pageSizeOptions, checkboxSelection, initialState, onStateChange, sx, etc.) and they behave as in the standard MUI grid.


Ref API

Use the same ref for ref and apiRef so you get both the grid API and the extra method.

The ref type (GoDataGridProRef or GoDataGridPremiumRef) includes:

  • The full MUI Grid API (e.g. exportState, restoreState, selection, sorting, filtering, etc.).

  • getStoredData() – returns the currently stored state and the key used in storage:

    getStoredData(): { key: string; value: GridInitialState | null }

Example:

const gridRef = useGridApiRef();

<GoDataGridPro ref={gridRef} apiRef={gridRef} id="my-grid" rows={rows} columns={columns} />

// Later:
const { key, value } = gridRef.current?.getStoredData() ?? {};
console.log('Storage key:', key, 'Stored state:', value);
gridRef.current?.exportState();
gridRef.current?.restoreState(someState);

Storage strategy & attributes

Strategy

  • GoDataGridProStorageStrategy.LOCAL_STORAGE / GoDataGridPremiumStorageStrategy.LOCAL_STORAGE – persist in localStorage (default).
  • GoDataGridProStorageStrategy.SESSION_STORAGE / GoDataGridPremiumStorageStrategy.SESSION_STORAGE – persist in sessionStorage.

Attributes (optional allowlist)

If you set storageAttributes, only these parts of the state are saved. Use the enum values:

  • COLUMNS
  • DENSITY
  • FILTER
  • PAGINATION
  • PINNED_COLUMNS
  • PREFERENCE_PANEL
  • SORTING

Example: save only filter, sorting, and pagination:

import {
  GoDataGridPro,
  GoDataGridProStorageStrategy,
  GoDataGridProStorageAttribute,
} from 'go-mui-datagrid';

<GoDataGridPro
  id="users-grid"
  storageStrategy={GoDataGridProStorageStrategy.LOCAL_STORAGE}
  storageAttributes={[
    GoDataGridProStorageAttribute.FILTER,
    GoDataGridProStorageAttribute.SORTING,
    GoDataGridProStorageAttribute.PAGINATION,
  ]}
  rows={rows}
  columns={columns}
/>

Same enums exist for Premium: GoDataGridPremiumStorageStrategy, GoDataGridPremiumStorageAttribute.


Usage examples

Basic Pro grid with persistence

import {
  GoDataGridPro,
  GoDataGridProStorageStrategy,
  type GoDataGridProRef,
} from 'go-mui-datagrid';
import { useGridApiRef } from '@mui/x-data-grid-pro';

const columns = [
  { field: 'id', headerName: 'ID', width: 90 },
  { field: 'name', headerName: 'Name', width: 150 },
  { field: 'email', headerName: 'Email', width: 200 },
];

const rows = [
  { id: 1, name: 'Alice', email: '[email protected]' },
  { id: 2, name: 'Bob', email: '[email protected]' },
];

export function MyGrid() {
  const gridRef = useGridApiRef<GoDataGridProRef>();

  return (
    <div style={{ height: 400, width: '100%' }}>
      <GoDataGridPro
        ref={gridRef}
        apiRef={gridRef}
        id="my-grid"
        rows={rows}
        columns={columns}
        storageStrategy={GoDataGridProStorageStrategy.LOCAL_STORAGE}
        pageSizeOptions={[5, 10, 25]}
        checkboxSelection
        disableRowSelectionOnClick
      />
    </div>
  );
}

Premium grid with session storage and resizable columns

import {
  GoDataGridPremium,
  GoDataGridPremiumStorageStrategy,
} from 'go-mui-datagrid';
import { useGridApiRef } from '@mui/x-data-grid-premium';

<GoDataGridPremium
  apiRef={useGridApiRef()}
  id="reports-grid"
  storageStrategy={GoDataGridPremiumStorageStrategy.SESSION_STORAGE}
  resizable
  rows={rows}
  columns={columns}
/>

Accessing stored data via ref

const gridRef = useRef<GoDataGridProRef | null>(null);

<GoDataGridPro ref={gridRef} apiRef={gridRef} id="my-grid" ... />

// In a handler:
const stored = gridRef.current?.getStoredData();
if (stored) {
  console.log('Key:', stored.key, 'State:', stored.value);
}

Module Federation

If you see "resolving fallback for shared module go-mui-datagrid", add the package to your host’s shared configuration.

Webpack:

shared: {
  'go-mui-datagrid': {
    requiredVersion: require('go-mui-datagrid/package.json').version,
    singleton: true,
  },
}

Vite + @originjs/vite-plugin-federation:

federation({
  shared: {
    'go-mui-datagrid': {
      requiredVersion: '^0.1.0',
      singleton: true,
    },
  },
})

Use compatible versions across host and remotes to avoid loading a second copy.


Then clear cache and restart:

rm -rf node_modules/.vite
npm run dev

If your app uses Webpack, ensure only one version of the grid is resolved (e.g. in resolve.alias or by deduplicating in resolve.modules). You can also add in resolve.alias:

'@mui/x-data-grid': path.resolve(__dirname, 'node_modules/@mui/x-data-grid'),
'@mui/x-data-grid-pro': path.resolve(__dirname, 'node_modules/@mui/x-data-grid-pro'),
'@mui/x-data-grid-premium': path.resolve(__dirname, 'node_modules/@mui/x-data-grid-premium'),

Also: install exactly one version of the grid in your app (e.g. one @mui/x-data-grid-pro and one @mui/x-data-grid-premium). If the error persists, try:

rm -rf node_modules package-lock.json
npm install

Development

# Install dependencies
npm install

# Build the library
npm run build

# Run the demo app
npm run dev

# Lint
npm run lint