React Data Grid Lite

Overview

๐Ÿ“˜ Introduction

The React Data Grid Lite is a high-performance, customizable UI component designed to display large sets of structured data in a tabular format. Built for modern applications, this grid focuses on speed, flexibility, and ease of integration, making it ideal for both simple lists and complex enterprise-grade data views.


๐ŸŽฏ Key Features

โšก Lightweight

A small bundle footprint ensures your application loads fast, even on slower connections. The grid is optimized to avoid unnecessary re-renders, includes zero dependencies, and only loads what it needs. Ideal for SPAs and mobile-first experiences.


๐Ÿ“ฆ API-ready

The grid works seamlessly with any REST or GraphQL JSON API. Simply fetch data and pass it to the data prop โ€” no additional formatting required. This makes integration with existing backend systems quick and painless.

fetch('/api/users')
  .then(res => res.json())
  .then(data => setGridData(data));

๐Ÿ› ๏ธ Dynamic Columns

Support for schema-flexible data means you can generate column definitions on the fly. This is especially useful for dashboards or CMS systems where data models can vary.

const columns = Object.keys(data[0]).map(key => ({ name: key }));

๐ŸŽจ Custom Cell Rendering

To customize how a specific cell is displayed, the columns definition can include a render function per column. This function receives the formatted row data, and the orignal row data, allowing full control over the rendering logic.

โœ… Add Icons or Badges

{
  name: 'role',
  alias: 'Role',
  render: (row) => (
    <span>
      {row.role === 'Admin' && '๐Ÿ›ก๏ธ '}
      {row.role}
    </span>
  )
}

๐Ÿ” Search & Aliases

Enable powerful global and column-level search with support for aliases and custom labels. Searchable columns can be marked with enableSearch: true, and you can use user-friendly names (alias) without affecting the actual data structure.

{ name: 'emailAddress', alias: 'Email', enableSearch: true }

๐Ÿ“Œ Fixed Columns

Pin columns to the left side of the grid using a prop like fixed: true. This is great for keeping key identifiers (like names or IDs) visible while horizontally scrolling through wide datasets.


๐Ÿ“ Resizable Columns

Users can drag column borders to adjust widths, making it easier to view large or wrapped content. This is enabled via built-in support in v1.1.0+ and fires an onColumnResized callback.

<DataGrid onColumnResized={(e, newWidth, columnName) => console.log(columnName, newWidth)} />

๐Ÿ“ฑ Responsive Layout

The grid layout adjusts to different screen sizes using width, maxWidth, height, and inherit props. It plays nicely with flexbox or grid-based layouts, ensuring content looks good on mobile, tablet, or desktop.

<DataGrid width="100%" height="60vh" />

๐Ÿงพ CSV Export

Allow users to download the currently viewed data as a .csv file. Ideal for admin panels, reporting dashboards, or finance tools. Supports exporting filtered or paginated data.


โœ๏ธ Row Actions

Built-in hooks for common actions like edit, delete allow you to bind behavior directly to row-level operations.


๐Ÿงฉ Merged Columns

Display composite values by merging multiple fields into a single cell. For example, show firstName + lastName in one column.

{ 
    name: 'firstname',
    alias: 'Name',
    concatColumns: { 
        columns: ['firstname', 'lastname'] 
    }
}

๐Ÿ“Š Analytics Events

Track interactions such as row clicks, sort changes, and searches using event callbacks. Useful for product analytics (e.g., Mixpanel, GA) or auditing user behavior.

onRowClick={(e, row) => logEvent('row_clicked', row)}

๐ŸŽจ Theming

Apply visual consistency with predefined themes like blue-core, dark-stack, and medi-glow. You can also pass in custom CSS classes or override default styles for headers, rows, hover states, etc.

<DataGrid theme="dark-stack" />

๐Ÿงฉ Actions Align

Use props like actionColumnAlign: 'right' or actionColumnAlign: 'left' to pin action column to one side, keeping UI controls consistent regardless of scroll position.


๐Ÿงช Fully Tested

The component comes with strong unit and integration test coverage, ensuring high reliability. Common scenarios โ€” like rendering, sorting, searching, and resizing โ€” are validated against regressions using tools like Jest and React Testing Library.


โœ… Pagination Built-in page handling with control over pageSize, currentPage, and callbacks like onPageChange.

โœ… Search & Filtering Global or per-column search capabilities for fast data filtering.

โœ… Event Hooks Callback props such as onRowClick, onSearchComplete, onSortComplete, and onColumnResized provide full lifecycle control.



React Data Grid Lite Image


๐Ÿ“ฆ Installation

npm install react-data-grid-lite

or

yarn add react-data-grid-lite

๐Ÿš€ Usage

import React from 'react';
import DataGrid from 'react-data-grid-lite';

const columns = [
  { name: 'id', width:'50px' },
  { name: 'name', alias:'Full Name' },
  { name: 'age' }
];

const rows = [
  { id: 1, name: 'John Doe', age: 28 },
  { id: 2, name: 'Jane Smith', age: 34 }
];

function App() {
  return (
    <DataGrid columns={columns} data={rows} />
  );
}

export default App;

React Compatibility Table

The react-data-grid-lite library is compatible with the following versions of React:

React Version Compatibility
React 19+ โœ… Fully Compatible
React 18+ โœ… Fully Compatible
React 17+ โœ… Fully Compatible

๐Ÿš€ Try It Out!

Feel free to fork the repository and experiment with the grid's behavior for concatenating columns. Let me know if you'd like any further adjustments or clarification! Happy coding! ๐ŸŽ‰


๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ™‹โ€โ™‚๏ธ Available for freelance work!

Reach out via LinkedIn or check out my projects on GitHub.

Have questions?

Contact on GitHub.