ag-grid
The best JavaScript Data Table for building Enterprise Applications. Supports React / Angular / Vue / Plain JavaScript.
Top Related Projects
JavaScript data grid with a spreadsheet look & feel. Works with React, Angular, and Vue. Supported by the Handsontable team ⚡
🤖 Headless UI for building powerful tables & datagrids for TS/JS - React-Table, Vue-Table, Solid-Table, Svelte-Table
React components for efficiently rendering large lists and tabular data
A lightning fast JavaScript grid/spreadsheet
Build interactive dashboards in minutes.
A draggable and resizable grid layout with responsive breakpoints, for React.
Quick Overview
AG Grid is a feature-rich and highly performant JavaScript data grid library for displaying tabular data. It supports both plain JavaScript and various frameworks like React, Angular, and Vue, offering a comprehensive solution for building complex data grids with advanced functionality.
Pros
- Excellent performance, even with large datasets
- Extensive feature set, including sorting, filtering, grouping, and cell editing
- Highly customizable with numerous configuration options
- Strong community support and regular updates
Cons
- Steep learning curve due to its extensive API and configuration options
- Large bundle size, which may impact initial load times
- Enterprise features require a paid license
- Documentation can be overwhelming for beginners
Code Examples
- Basic grid setup with column definitions:
const gridOptions = {
columnDefs: [
{ field: 'make' },
{ field: 'model' },
{ field: 'price' }
],
rowData: [
{ make: 'Toyota', model: 'Celica', price: 35000 },
{ make: 'Ford', model: 'Mondeo', price: 32000 },
{ make: 'Porsche', model: 'Boxster', price: 72000 }
]
};
- Enabling sorting and filtering:
const gridOptions = {
columnDefs: [
{ field: 'make', sortable: true, filter: true },
{ field: 'model', sortable: true, filter: true },
{ field: 'price', sortable: true, filter: 'agNumberColumnFilter' }
],
// ... row data
};
- Adding a custom cell renderer:
const gridOptions = {
columnDefs: [
{
field: 'price',
cellRenderer: params => {
return `$${params.value.toLocaleString()}`;
}
}
],
// ... other options
};
Getting Started
To get started with AG Grid, follow these steps:
- Install AG Grid:
npm install ag-grid-community
- Import AG Grid in your JavaScript file:
import { Grid } from 'ag-grid-community';
import 'ag-grid-community/styles/ag-grid.css';
import 'ag-grid-community/styles/ag-theme-alpine.css';
- Create a grid instance:
const gridOptions = {
columnDefs: [
{ field: 'make' },
{ field: 'model' },
{ field: 'price' }
],
rowData: [
{ make: 'Toyota', model: 'Celica', price: 35000 },
{ make: 'Ford', model: 'Mondeo', price: 32000 },
{ make: 'Porsche', model: 'Boxster', price: 72000 }
]
};
const gridDiv = document.querySelector('#myGrid');
new Grid(gridDiv, gridOptions);
This will create a basic AG Grid instance with sample data. You can then customize and extend the grid based on your specific requirements.
Competitor Comparisons
JavaScript data grid with a spreadsheet look & feel. Works with React, Angular, and Vue. Supported by the Handsontable team ⚡
Pros of Handsontable
- More intuitive and spreadsheet-like interface
- Better support for Excel-like formulas and calculations
- Easier to implement for simple data grids
Cons of Handsontable
- Less performant with large datasets compared to AG Grid
- Fewer advanced features for complex data manipulation
- Limited built-in filtering and sorting capabilities
Code Comparison
Handsontable:
const hot = new Handsontable(container, {
data: dataset,
rowHeaders: true,
colHeaders: true,
filters: true,
dropdownMenu: true
});
AG Grid:
const gridOptions = {
columnDefs: columnDefs,
rowData: rowData,
enableSorting: true,
enableFilter: true,
enableColResize: true
};
new agGrid.Grid(gridDiv, gridOptions);
Both libraries offer powerful data grid solutions, but they cater to different use cases. Handsontable excels in creating spreadsheet-like interfaces with familiar Excel-style functionality, making it ideal for simpler data grids and user-friendly editing. AG Grid, on the other hand, provides superior performance for large datasets and offers more advanced features for complex data manipulation, filtering, and sorting. The choice between the two depends on the specific requirements of your project, such as data size, complexity, and desired user experience.
🤖 Headless UI for building powerful tables & datagrids for TS/JS - React-Table, Vue-Table, Solid-Table, Svelte-Table
Pros of TanStack Table
- Lightweight and flexible, with a smaller bundle size
- Framework-agnostic, supporting React, Vue, Solid, and vanilla JS
- Highly customizable with a modular architecture
Cons of TanStack Table
- Less out-of-the-box features compared to AG Grid
- Steeper learning curve for complex implementations
- Limited built-in UI components, requiring more custom styling
Code Comparison
AG Grid (React):
import { AgGridReact } from 'ag-grid-react';
<AgGridReact
columnDefs={columnDefs}
rowData={rowData}
onGridReady={onGridReady}
/>
TanStack Table (React):
import { useTable } from '@tanstack/react-table';
const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } = useTable({
columns,
data,
});
Both libraries offer powerful table functionality, but AG Grid provides more built-in features and a comprehensive UI out of the box. TanStack Table, on the other hand, offers greater flexibility and a smaller footprint, making it ideal for custom implementations across various frameworks.
React components for efficiently rendering large lists and tabular data
Pros of react-virtualized
- Lightweight and focused on virtualization, making it more suitable for specific use cases
- Offers flexibility with customizable components for various virtualized layouts
- Better integration with React ecosystem and component-based architecture
Cons of react-virtualized
- Limited built-in features compared to ag-Grid's comprehensive data grid functionality
- Less extensive documentation and community support
- May require more custom development for complex grid requirements
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>
)}
/>
ag-Grid:
import { AgGridReact } from 'ag-grid-react';
<AgGridReact
columnDefs={columnDefs}
rowData={rowData}
defaultColDef={{
sortable: true,
filter: true
}}
/>
Summary
react-virtualized is a lightweight library focused on virtualization, offering flexibility and better React integration. However, it has limited built-in features and may require more custom development for complex grids. ag-Grid provides a more comprehensive data grid solution with extensive features and documentation but may be overkill for simpler use cases. The choice between the two depends on the specific project requirements and complexity of the data presentation needs.
A lightning fast JavaScript grid/spreadsheet
Pros of SlickGrid
- Lightweight and fast, with minimal dependencies
- Highly customizable with a flexible plugin architecture
- Better suited for simpler grid requirements and smaller datasets
Cons of SlickGrid
- Less actively maintained compared to ag-Grid
- Fewer built-in features and less comprehensive documentation
- Limited support for modern frameworks and responsive design
Code Comparison
SlickGrid:
var grid = new Slick.Grid("#myGrid", data, columns, options);
grid.onCellChange.subscribe(function (e, args) {
// Handle cell change
});
ag-Grid:
var gridOptions = {
columnDefs: columnDefs,
rowData: rowData,
onCellValueChanged: function(event) {
// Handle cell change
}
};
new agGrid.Grid(gridDiv, gridOptions);
Summary
SlickGrid is a lightweight and flexible grid library that excels in simplicity and customization. It's ideal for projects with basic grid requirements and smaller datasets. However, it lacks the extensive feature set and active development of ag-Grid.
ag-Grid offers a more comprehensive solution with better support for modern frameworks, responsive design, and larger datasets. It provides more out-of-the-box features and regular updates but may be overkill for simpler projects.
Choose SlickGrid for lightweight, highly customizable grids in simpler applications. Opt for ag-Grid when you need a feature-rich, actively maintained grid solution for complex enterprise applications.
Build interactive dashboards in minutes.
Pros of Gridstack.js
- Lightweight and focused on drag-and-drop grid layouts
- Easier to set up for simple grid-based dashboards
- Better suited for responsive, resizable widget-style layouts
Cons of Gridstack.js
- Limited data handling capabilities compared to AG Grid
- Fewer built-in features for complex data manipulation and filtering
- Less extensive documentation and community support
Code Comparison
Gridstack.js basic setup:
<div class="grid-stack">
<div class="grid-stack-item" data-gs-x="0" data-gs-y="0" data-gs-width="4" data-gs-height="2">
<div class="grid-stack-item-content">My widget content</div>
</div>
</div>
<script>
var grid = GridStack.init();
</script>
AG Grid basic setup:
<div id="myGrid" style="height: 200px; width:500px;" class="ag-theme-alpine"></div>
<script>
var gridOptions = {
columnDefs: [{ field: 'make' }, { field: 'model' }, { field: 'price' }],
rowData: [{ make: 'Toyota', model: 'Celica', price: 35000 }]
};
new agGrid.Grid(document.querySelector('#myGrid'), gridOptions);
</script>
This comparison highlights the different focus areas of these libraries. Gridstack.js is more suited for creating flexible, widget-based layouts, while AG Grid excels in handling and displaying large datasets with advanced features.
A draggable and resizable grid layout with responsive breakpoints, for React.
Pros of react-grid-layout
- Lightweight and focused on grid layout functionality
- Easy to integrate with existing React applications
- Highly customizable with drag-and-drop support
Cons of react-grid-layout
- Limited to grid layouts, lacking advanced data grid features
- Requires additional libraries for complex data handling and filtering
- Less comprehensive documentation compared to AG Grid
Code Comparison
react-grid-layout:
import GridLayout from 'react-grid-layout';
<GridLayout
className="layout"
layout={layout}
cols={12}
rowHeight={30}
width={1200}
>
{children}
</GridLayout>
AG Grid:
import { AgGridReact } from 'ag-grid-react';
<AgGridReact
columnDefs={columnDefs}
rowData={rowData}
defaultColDef={defaultColDef}
onGridReady={onGridReady}
/>
react-grid-layout is ideal for creating responsive, draggable grid layouts in React applications. It's lightweight and easy to implement but lacks advanced data grid features. AG Grid, on the other hand, offers a comprehensive set of data grid functionalities, including sorting, filtering, and cell rendering, making it more suitable for complex data-driven applications. While react-grid-layout focuses on layout management, AG Grid excels in handling large datasets and providing advanced grid features.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
JavaScript Data Grid | JavaScript Table
AG Grid is a fully-featured and highly customizable JavaScript Data Grid. It delivers outstanding performance, has no third-party dependencies and comes with support for React, Angular and Vue.
ð Overview
Table of Contents
- [JavaScript Data Grid | JavaScript Table]
AG Grid is available in two versions: Community & Enterprise.
ag-grid-community
is free, available under the MIT license, and comes with all of the core features expected from a JavaScript Data Grid, including Sorting, Filtering, Pagination, Editing, Custom Components, Theming and more.ag-grid-enterprise
is available under a commercial license and comes with advanced features, like Integrated Charting, Row Grouping, Aggregation, Pivoting, Master/Detail, Server-side Row Model, and Exporting in addition to dedicated support from our Engineering team.
Features
Feature | AG Grid Community | AG Grid Enterprise |
---|---|---|
Filtering | â | â (Advanced) |
Sorting | â | â |
Cell Editing | â | â |
CSV Export | â | â |
Drag & Drop | â | â |
Themes and Styling | â | â |
Selection | â | â |
Accessibility | â | â |
Infinite Scrolling | â | â |
Pagination | â | â |
Server-Side Data | â | â (Advanced) |
Custom Components | â | â |
Integrated Charting | â | â |
Range Selection | â | â |
Row Grouping and Aggregation | â | â |
Pivoting | â | â |
Excel Export | â | â |
Clipboard Operations | â | â |
Master/Detail | â | â |
Tree Data | â | â |
Column Menu | â | â |
Context Menu | â | â |
Tool Panels | â | â |
Support | â | â |
â¹ï¸ Note:
Visit the Pricing page for a full comparison.
Examples
We've created several demos to showcase AG Grid's rich feature set across different use cases. See them in action below, or interact with them on our Demo page.
ð¦ Financial Demo
Financial data example featuring live updates and sparklines:
â¡ï¸ Quick Start
AG Grid is easy to set up - all you need to do is provide your data and define your column structure. Read on for vanilla JavaScript installation instructions, or refer to our framework-specific guides for React, Angular and Vue.
Installation
$ npm install --save ag-grid-community
Setup
1. Provide a Container
Load the AG Grid library and create a container div. The div should have a height because the Data Grid will fill the size of the parent container:
<html lang="en">
<head>
<!-- Includes all JS & CSS for the JavaScript Data Grid -->
<script src="https://cdn.jsdelivr.net/npm/ag-grid-community/dist/ag-grid-community.min.js"></script>
</head>
<body>
<!-- Your Data Grid container -->
<div id="myGrid" style="height: 500px"></div>
</body>
</html>
2. Instantiating the JavaScript Data Grid
Create the Data Grid inside of your container div using createGrid
.
// Grid Options: Contains all of the Data Grid configurations
const gridOptions = {};
// Your Javascript code to create the Data Grid
const myGridElement = document.querySelector('#myGrid');
agGrid.createGrid(myGridElement, gridOptions);
3. Define Rows and Columns
// Grid Options: Contains all of the Data Grid configurations
const gridOptions = {
// Row Data: The data to be displayed.
rowData: [
{ make: 'Tesla', model: 'Model Y', price: 64950, electric: true },
{ make: 'Ford', model: 'F-Series', price: 33850, electric: false },
{ make: 'Toyota', model: 'Corolla', price: 29600, electric: false },
],
// Column Definitions: Defines the columns to be displayed.
columnDefs: [{ field: 'make' }, { field: 'model' }, { field: 'price' }, { field: 'electric' }],
};
â¹ï¸ Note:
For more information on building Data Grids with AG Grid, refer to our Documentation.
Seed Projects
We also provide Seed Projects to help you get started with common configurations:
Environment | Framework | Packages | Modules |
---|---|---|---|
Create React App (CRA) | Packages | Modules | |
Vite | Packages | Modules | |
Vite - TypeScript | Packages | Modules | |
Webpack 5 - TypeScript | Packages | Modules | |
Webpack 5 - JavaScript | Packages | Modules | |
Angular CLI | Packages | Modules | |
Nuxt | Packages | Modules | |
Vite | Packages | Modules |
ð ï¸ Customisations
AG Grid is fully customisable, both in terms of appearance and functionality. There are many ways in which the grid can be customised and we provide a selection of tools to help create those customisations.
Custom Components
You can create your own Custom Components to customise the behaviour of the grid. For example, you can customise how cells are rendered, how values are edited and also create your own filters.
There are a number of different Component Types that you can provide to the grid, including:
- Cell Component: To customise the contents of a cell.
- Header Component: To customise the header of a column and column groups.
- Edit Component: To customise the editing of a cell.
- Filter Component: For custom column filter that appears inside the column menu.
- Floating Filter: For custom column floating filter that appears inside the column menu.
- Date Component: To customise the date selection component in the date filter.
- Loading Component: To customise the loading cell row when using Server Side Row Model.
- Overlay Component: To customise loading and no rows overlay components.
- Status Bar Component: For custom status bar components.
- Tool Panel Component: For custom tool panel components.
- Tooltip Component: For custom cell tooltip components.
- Menu Item Component: To customise the menu items shown in the Column and Context Menus.
To supply a custom cell renderer and filter components to the Grid, create a direct reference to your component within the gridOptions.columnDefs
property:
gridOptions = {
columnDefs: [
{
field: 'country', // The column to add the component to
cellRenderer: CountryCellRenderer, // Your custom cell component
filter: CountryFilter, // Your custom filter component
},
],
};
Themes
AG Grid has 4 themes, each available in light
& dark
modes:
Quartz | Material |
---|---|
Alpine | Balham |
Custom Themes
All AG Grid themes can be customised using the Theming API, or you can create a new theme from scratch with the help of our Theme Builder or Figma Design System.
ð Community
Tools & Extensions
AG Grid has a large and active community who have created an ecosystem of 3rd party tools, extensions and utilities to help you build your next project with AG Grid, no matter which language or framework you use:
Showcase
AG Grid is used by 100,000's of developers across the world, from almost every industry. Whilst most of these projects are private, we've curated a selection of open-source projects from different industries where household names use AG Grid, including J.P.Morgan, MongoDB and NASA. Visit our Community Showcase page to learn more.
Stargazers
Founded in 2016, AG Grid has seen a steady rise in popularity and is now the market leader for Data Grids:
ð¤ Support
Enterprise Support
AG Grid Enterprise customers have access to dedicated support via ZenDesk, which is monitored by our engineering teams.
Bug Reports
If you have found a bug, please report it in this repository's issues section.
Questions
Look for similar problems on StackOverflow using the ag-grid
tag. If nothing seems related, post a new message there. Please do not use GitHub issues to ask questions.
Contributing
AG Grid is developed by a team of co-located developers in London. If you want to join the team send your application to info@ag-grid.com.
â ï¸ License
ag-grid-community
is licensed under the MIT license.
ag-grid-enterprise
has a Commercial license.
See the LICENSE file for more info.
AG Charts
If you've made it this far, you may be interested in our latest project: AG Charts - The best JavaScript Charting library in the world.
Initially built to power Integrated Charts in AG Grid, we open-sourced this project in 2018. Having seen the steady rise in popularity since then, we have decided to invest in AG Charts with a dedicated Enterprise version (ag-charts-enterprise
) in addition to our continued support of ag-charts-community
.
Top Related Projects
JavaScript data grid with a spreadsheet look & feel. Works with React, Angular, and Vue. Supported by the Handsontable team ⚡
🤖 Headless UI for building powerful tables & datagrids for TS/JS - React-Table, Vue-Table, Solid-Table, Svelte-Table
React components for efficiently rendering large lists and tabular data
A lightning fast JavaScript grid/spreadsheet
Build interactive dashboards in minutes.
A draggable and resizable grid layout with responsive breakpoints, for React.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot