Convert Figma logo to code with AI

grid-js logogridjs

Advanced table plugin

4,401
241
4,401
126

Top Related Projects

12,496

The best JavaScript Data Table for building Enterprise Applications. Supports React / Angular / Vue / Plain JavaScript.

JavaScript data grid with a spreadsheet look & feel. Works with React, Angular, and Vue. Supported by the Handsontable team ⚡

25,067

🤖 Headless UI for building powerful tables & datagrids for TS/JS - React-Table, Vue-Table, Solid-Table, Svelte-Table

A lightning fast JavaScript grid/spreadsheet

React components for efficiently rendering large lists and tabular data

Feature-rich and customizable data grid React component

Quick Overview

Grid.js is a free and open-source JavaScript table plugin. It offers a simple and customizable solution for creating data tables with features like sorting, pagination, and search functionality. Grid.js is designed to work with various frameworks and can be used with both static and dynamic data sources.

Pros

  • Lightweight and fast, with no dependencies
  • Highly customizable with a wide range of built-in plugins and themes
  • Supports server-side data processing and pagination
  • Easy integration with popular JavaScript frameworks (React, Vue, Angular)

Cons

  • Limited advanced features compared to some larger table libraries
  • Documentation could be more comprehensive for complex use cases
  • Styling options may require additional CSS knowledge for extensive customization
  • Relatively smaller community compared to more established table libraries

Code Examples

  1. Basic table creation:
import { Grid } from "gridjs";

new Grid({
  columns: ["Name", "Email", "Phone Number"],
  data: [
    ["John", "john@example.com", "(353) 01 222 3333"],
    ["Mark", "mark@gmail.com", "(01) 22 888 4444"],
    ["Eoin", "eoin@gmail.com", "0097 22 654 00033"]
  ]
}).render(document.getElementById("wrapper"));
  1. Table with pagination and search:
import { Grid } from "gridjs";

new Grid({
  columns: ["Name", "Email", "Phone Number"],
  data: [
    ["John", "john@example.com", "(353) 01 222 3333"],
    ["Mark", "mark@gmail.com", "(01) 22 888 4444"],
    ["Eoin", "eoin@gmail.com", "0097 22 654 00033"]
  ],
  search: true,
  pagination: {
    limit: 2
  }
}).render(document.getElementById("wrapper"));
  1. Table with server-side data:
import { Grid } from "gridjs";

new Grid({
  columns: ["Name", "Email", "Phone Number"],
  server: {
    url: 'https://api.example.com/data',
    then: data => data.map(user => [user.name, user.email, user.phone])
  },
  sort: true,
  search: true
}).render(document.getElementById("wrapper"));

Getting Started

  1. Install Grid.js using npm:

    npm install gridjs
    
  2. Import Grid.js in your JavaScript file:

    import { Grid } from "gridjs";
    
  3. Create a container element in your HTML:

    <div id="wrapper"></div>
    
  4. Initialize and render the Grid:

    new Grid({
      columns: ["Name", "Email"],
      data: [
        ["John", "john@example.com"],
        ["Mark", "mark@gmail.com"]
      ]
    }).render(document.getElementById("wrapper"));
    

Competitor Comparisons

12,496

The best JavaScript Data Table for building Enterprise Applications. Supports React / Angular / Vue / Plain JavaScript.

Pros of AG Grid

  • More feature-rich with advanced functionalities like pivoting, grouping, and filtering
  • Extensive documentation and community support
  • Enterprise version available with additional features

Cons of AG Grid

  • Steeper learning curve due to its complexity
  • Larger bundle size, which may impact performance for simpler use cases
  • Pricing model for enterprise features can be expensive for some projects

Code Comparison

GridJS:

new Grid({
  columns: ['Name', 'Email', 'Phone Number'],
  data: [
    ['John', 'john@example.com', '(353) 01 222 3333'],
    ['Mark', 'mark@gmail.com', '(01) 22 888 4444']
  ]
}).render(document.getElementById('wrapper'));

AG Grid:

const gridOptions = {
  columnDefs: [
    { field: 'name' },
    { field: 'email' },
    { field: 'phone' }
  ],
  rowData: [
    { name: 'John', email: 'john@example.com', phone: '(353) 01 222 3333' },
    { name: 'Mark', email: 'mark@gmail.com', phone: '(01) 22 888 4444' }
  ]
};
new agGrid.Grid(document.querySelector('#myGrid'), gridOptions);

Both libraries offer easy setup for basic grid functionality, but AG Grid's configuration is more verbose and allows for more customization options.

JavaScript data grid with a spreadsheet look & feel. Works with React, Angular, and Vue. Supported by the Handsontable team ⚡

Pros of Handsontable

  • More feature-rich with advanced functionalities like data validation, filtering, and sorting
  • Supports Excel-like formulas and cell dependencies
  • Offers both open-source and commercial versions with additional enterprise features

Cons of Handsontable

  • Larger file size and potentially higher performance overhead
  • Steeper learning curve due to its extensive API and configuration options
  • Commercial license required for some advanced features and use cases

Code Comparison

Handsontable:

const container = document.getElementById('example');
const hot = new Handsontable(container, {
  data: data,
  rowHeaders: true,
  colHeaders: true,
  filters: true,
  dropdownMenu: true
});

Grid.js:

new Grid({
  columns: ['Name', 'Email', 'Phone Number'],
  data: [
    ['John', 'john@example.com', '(353) 01 222 3333'],
    ['Mark', 'mark@gmail.com', '(01) 22 888 4444']
  ]
}).render(document.getElementById('wrapper'));

Both libraries offer easy setup for creating data grids, but Handsontable provides more built-in features out of the box. Grid.js focuses on simplicity and lightweight implementation, making it easier to get started with basic grid functionality. Handsontable is better suited for complex, spreadsheet-like applications, while Grid.js is ideal for simpler data presentation needs with a smaller footprint.

25,067

🤖 Headless UI for building powerful tables & datagrids for TS/JS - React-Table, Vue-Table, Solid-Table, Svelte-Table

Pros of TanStack Table

  • More flexible and customizable, allowing for complex table configurations
  • Better TypeScript support with strong typing
  • Supports advanced features like virtualization and infinite scrolling

Cons of TanStack Table

  • Steeper learning curve due to its more complex API
  • Requires more setup and configuration compared to GridJS
  • Larger bundle size, which may impact performance for smaller projects

Code Comparison

GridJS:

new Grid({
  columns: ['Name', 'Email', 'Phone Number'],
  data: [
    ['John', 'john@example.com', '(353) 01 222 3333'],
    ['Mark', 'mark@gmail.com', '(01) 22 888 4444']
  ]
}).render(document.getElementById('wrapper'));

TanStack Table:

const table = useReactTable({
  data,
  columns,
  getCoreRowModel: getCoreRowModel(),
})

return (
  <table>
    {table.getHeaderGroups().map(headerGroup => (
      // Header rendering logic
    ))}
    <tbody>
      {table.getRowModel().rows.map(row => (
        // Row rendering logic
      ))}
    </tbody>
  </table>
)

Both libraries offer powerful table functionality, but TanStack Table provides more advanced features and flexibility at the cost of complexity, while GridJS offers a simpler API for basic table needs.

A lightning fast JavaScript grid/spreadsheet

Pros of SlickGrid

  • Highly performant with large datasets (100,000+ rows)
  • Extensive customization options and plugin ecosystem
  • Advanced features like frozen columns and rows

Cons of SlickGrid

  • Steeper learning curve due to complexity
  • Less modern UI out of the box
  • Requires jQuery dependency

Code Comparison

SlickGrid:

var grid = new Slick.Grid("#myGrid", data, columns, options);
grid.onCellChange.subscribe(function (e, args) {
  // Handle cell change
});

GridJS:

new Grid({
  columns: ['Name', 'Email'],
  data: [['John', 'john@example.com']]
}).render(document.getElementById('wrapper'));

Key Differences

  • SlickGrid offers more advanced features and customization but requires more setup
  • GridJS provides a simpler API and modern look, making it easier to get started
  • SlickGrid excels at handling large datasets, while GridJS is more suitable for smaller to medium-sized grids
  • GridJS is framework-agnostic and doesn't require external dependencies, unlike SlickGrid which relies on jQuery

Both libraries have their strengths, with SlickGrid being better suited for complex, data-intensive applications, while GridJS offers a more straightforward solution for simpler use cases with a modern look and feel.

React components for efficiently rendering large lists and tabular data

Pros of react-virtualized

  • Highly optimized for rendering large lists and tabular data
  • Supports windowing techniques for efficient rendering of large datasets
  • Offers a wide range of components for various use cases (List, Grid, Table, etc.)

Cons of react-virtualized

  • Steeper learning curve due to its complex API and numerous configuration options
  • Requires more setup and boilerplate code compared to simpler solutions
  • May be overkill for smaller datasets or simpler use cases

Code Comparison

react-virtualized:

import { List } from 'react-virtualized';

<List
  width={300}
  height={300}
  rowCount={1000}
  rowHeight={20}
  rowRenderer={({ key, index, style }) => (
    <div key={key} style={style}>Row {index}</div>
  )}
/>

gridjs:

import { Grid } from "gridjs-react";

<Grid
  data={[
    ['John', 'john@example.com'],
    ['Mike', 'mike@example.com']
  ]}
  columns={['Name', 'Email']}
/>

react-virtualized focuses on efficient rendering of large datasets using virtualization techniques, while gridjs provides a simpler API for creating data tables with built-in features like sorting and pagination. react-virtualized offers more flexibility and performance optimizations, but requires more setup. gridjs is easier to use out of the box for basic table needs but may not scale as well for very large datasets.

Feature-rich and customizable data grid React component

Pros of react-data-grid

  • Specifically designed for React applications, offering seamless integration
  • Extensive features for advanced data manipulation, including cell editing and custom renderers
  • Strong community support and regular updates

Cons of react-data-grid

  • Steeper learning curve due to its complex API and numerous features
  • Larger bundle size, which may impact performance in smaller applications
  • Limited built-in styling options, often requiring additional CSS customization

Code Comparison

react-data-grid:

import ReactDataGrid from 'react-data-grid';

const columns = [
  { key: 'id', name: 'ID' },
  { key: 'name', name: 'Name' }
];

const rows = [
  { id: 1, name: 'John' },
  { id: 2, name: 'Jane' }
];

function MyGrid() {
  return <ReactDataGrid columns={columns} rows={rows} />;
}

gridjs:

import { Grid } from "gridjs";

new Grid({
  columns: ["ID", "Name"],
  data: [
    [1, "John"],
    [2, "Jane"]
  ]
}).render(document.getElementById("wrapper"));

While react-data-grid is tailored for React applications with advanced features, gridjs offers a simpler, framework-agnostic approach. react-data-grid provides more customization options but requires more setup, whereas gridjs focuses on ease of use and quick implementation across various environments.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Grid.js

All Contributors

Grid.js

Advanced table plugin

A table library that works everywhere

  • Simple and lightweight implementation
  • No vendor lock-in. Grid.js can be used with any JavaScript frameworks (React, Angular, Preact or VanillaJS)
  • Written in TypeScript
  • Supports all modern browsers and IE11+

Example

new Grid({
  data: [
    ['Mike', 33, 'mike@murphy.com'],
    ['John', 82, 'john@conway.com'],
    ['Sara', 26, 'sara@keegan.com']
  ],
  columns: ['Name', 'Age', 'Email']
}).render(document.getElementById('wrapper'));

Piece of :cake:

Getting Started

Documentation :book:

Full documentation of Grid.js installation, config, API and examples are available on Grid.js website grid.js/docs.

Community

  • Join our Discord channel
  • Take a look at gridjs tag on StackOverflow or ask your own question!
  • Read our blog for the latest updates and announcements
  • Follow our Twitter account @grid_js

Contributors ✨


Afshin Mehrabani

💻 📖

Daniel Sieradski

🔌

Salama Ashoush

🔌

Daniel Werner

🔌

Aloysb

💻 📖

License

MIT

NPM DownloadsLast 30 Days