Back to Ag Grid

React Data Grid | React Table

packages/ag-grid-react/README.md

100.0.044.4 KB
Original Source

React Data Grid | React Table

<div align="center"> <a href="https://www.ag-grid.com?utm_source=ag-grid-react-readme&utm_medium=repository&utm_campaign=github"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://github.com/ag-grid/ag-grid/blob/latest/documentation/ag-grid-docs/public/images/ag-logos/svg-logos/AG-Grid-Logo_Dark-Theme.svg?raw=true"/> <source media="(prefers-color-scheme: light)" srcset="https://github.com/ag-grid/ag-grid/blob/latest/documentation/ag-grid-docs/public/images/ag-logos/svg-logos/AG-Grid-Logo_Light-Theme.svg?raw=true"/>
    </picture>
</a>
<div align="center">
    <h4><a href="https://www.ag-grid.com?utm_source=ag-grid-react-readme&utm_medium=repository&utm_campaign=github">🌐 Website</a> β€’ <a href="https://www.ag-grid.com/react-data-grid/getting-started/?utm_source=ag-grid-react-readme&utm_medium=repository&utm_campaign=github">πŸ“– Documentation</a> β€’ <a href="https://www.ag-grid.com/community?utm_source=ag-grid-react-readme&utm_medium=repository&utm_campaign=github">🏘️ Community</a></h4>
</div>


<a href="https://github.com/ag-grid/ag-grid/releases">
    
</a>
<a href="https://www.npmjs.com/package/ag-grid-react">
    
</a>
<a href="https://github.com/ag-grid/ag-grid">
    
</a>
<a href="https://github.com/ag-grid/ag-grid">
    
</a>



<a href="https://sonarcloud.io/dashboard?id=ag-grid-community">
  
</a>
<a href="https://npm.io/package/ag-grid-react">
    
</a>
<a href="https://github.com/ag-grid/ag-grid/graphs/commit-activity">
    
</a>
<a href="https://github.com/ag-grid/ag-grid/network/dependents">
    
</a>



<!-- START MAIN DESCRIPTION -->
<p>AG Grid is a <strong>fully-featured</strong> and <strong>highly customizable</strong> React Data Grid. It delivers <strong>outstanding performance</strong> and has <strong>no third-party dependencies</strong>.</p>	
<!-- END MAIN DESCRIPTION --> </div> <picture> <source srcset="https://github.com/ag-grid/ag-grid/blob/latest/readme-assets/kitchen-sink-demo-light.gif?raw=true" media="(prefers-color-scheme: light)"> <source srcset="https://github.com/ag-grid/ag-grid/blob/latest/readme-assets/kitchen-sink-demo-dark.gif?raw=true" media="(prefers-color-scheme: dark)"> </picture> <div align="right"> <a href="https://www.ag-grid.com/example/?utm_source=ag-grid-react-readme&utm_medium=repository&utm_campaign=github"> </a> </div>

πŸ“– Overview

<details> <summary><strong>Table of Contents</strong></summary> </details>

AG Grid is available in two versions: Community & Enterprise.

Features

FeatureAG Grid CommunityAG Grid Enterprise
MCP Serverβœ…βœ… (Advanced)
Filteringβœ…βœ… (Advanced)
Sortingβœ…βœ…
Cell Editingβœ…βœ…
CSV Exportβœ…βœ…
Drag & Dropβœ…βœ…
Themes and Stylingβœ…βœ…
Selectionβœ…βœ…
Accessibilityβœ…βœ…
Infinite Scrollingβœ…βœ…
Paginationβœ…βœ…
Server-Side Dataβœ…βœ… (Advanced)
Custom Componentsβœ…βœ…
AI ToolkitβŒβœ…
Integrated ChartingβŒβœ…
FormulasβŒβœ…
FindβŒβœ…
Range SelectionβŒβœ…
Row Grouping and AggregationβŒβœ…
PivotingβŒβœ…
Excel ExportβŒβœ…
Clipboard OperationsβŒβœ…
Master/DetailβŒβœ…
Tree DataβŒβœ…
Column MenuβŒβœ…
Context MenuβŒβœ…
Tool PanelsβŒβœ…
SupportβŒβœ…
<blockquote> <p>ℹ️ <b>Note:</b></p> <span>Visit the <a href="https://www.ag-grid.com/license-pricing/?utm_source=ag-grid-react-readme&utm_medium=repository&utm_campaign=github">Pricing</a> page for a full comparison.</span> </blockquote>

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.

<details open> <summary>🏦 <b>Financial Demo</b></summary> <p>Financial data example featuring live updates and sparklines:</p> <a href="https://www.ag-grid.com/example-finance/?utm_source=ag-grid-react-readme&utm_medium=repository&utm_campaign=github"> <picture> <source srcset="https://github.com/ag-grid/ag-grid/blob/latest/readme-assets/finance-demo-light.gif?raw=true" media="(prefers-color-scheme: light)"> <source srcset="https://github.com/ag-grid/ag-grid/blob/latest/readme-assets/finance-demo-dark.gif?raw=true" media="(prefers-color-scheme: dark)">
</picture>
</a> <div align="right"><span><a href="https://www.ag-grid.com/example-finance/?utm_source=ag-grid-react-readme&utm_medium=repository&utm_campaign=github">Live Demo</a></span>&nbsp;β€’&nbsp;<span><a href="https://github.com/ag-grid/ag-grid-demos/tree/main/finance">Source Code</a></span></div> </details> <details> <summary>πŸ“¦ <b>Inventory Demo</b></summary> <p>Inventory data example to view and manage products:</p> <a href="https://www.ag-grid.com/example-inventory/?utm_source=ag-grid-react-readme&utm_medium=repository&utm_campaign=github"> <picture> <source srcset="https://github.com/ag-grid/ag-grid/blob/latest/readme-assets/inventory-demo-light.gif?raw=true" media="(prefers-color-scheme: light)"> <source srcset="https://github.com/ag-grid/ag-grid/blob/latest/readme-assets/inventory-demo-dark.gif?raw=true" media="(prefers-color-scheme: dark)">
</picture>
</a> <div align="right"><span><a href="https://www.ag-grid.com/example-inventory/?utm_source=ag-grid-react-readme&utm_medium=repository&utm_campaign=github">Live Demo</a></span>&nbsp;β€’&nbsp;<span><a href="https://github.com/ag-grid/ag-grid-demos/tree/main/inventory">Source Code</a></span></div> </details> <details> <summary>πŸ§‘β€πŸ’Ό <b>HR Demo</b></summary> <p>HR data example showing hierarchical employee data:</p> <a href="https://www.ag-grid.com/example-hr/?utm_source=ag-grid-react-readme&utm_medium=repository&utm_campaign=github"> <picture> <source srcset="https://github.com/ag-grid/ag-grid/blob/latest/readme-assets/hr-demo-light.gif?raw=true" media="(prefers-color-scheme: light)"> <source srcset="https://github.com/ag-grid/ag-grid/blob/latest/readme-assets/hr-demo-dark.gif?raw=true" media="(prefers-color-scheme: dark)">
</picture>
</a> <div align="right"><span><a href="https://www.ag-grid.com/example-hr/?utm_source=ag-grid-react-readme&utm_medium=repository&utm_campaign=github">Live Demo</a></span>&nbsp;β€’&nbsp;<span><a href="https://github.com/ag-grid/ag-grid-demos/tree/main/hr">Source Code</a></span></div> </details>

⚑️ Quick Start

<!-- START QUICK START DESCRIPTION -->

AG Grid is easy to set up - all you need to do is provide your data and define your column structure.

<!-- END QUICK START DESCRIPTION -->

Installation

sh
$ npm install --save ag-grid-react

Setup

<!-- START SETUP -->

1. Register Modules

Register the AllCommunityModule to access all Community features:

js
import { AllCommunityModule, ModuleRegistry } from 'ag-grid-community';

// Register all Community features
ModuleRegistry.registerModules([AllCommunityModule]);
<blockquote> <p>ℹ️ <b>Note:</b></p> <p>To minimize bundle size, only register the modules you want to use. See the <a href="https://www.ag-grid.com/react-data-grid/modules/">Modules</a> page for more information.</p> </blockquote>

2. Import the React Data Grid

js
// React Data Grid Component
import { AgGridReact } from 'ag-grid-react';

3. Define Rows and Columns

js
const GridExample = () => {
    // Row Data: The data to be displayed.
    const [rowData, setRowData] = useState([
        { 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.
    const [colDefs, setColDefs] = useState([
        { field: 'make' },
        { field: 'model' },
        { field: 'price' },
        { field: 'electric' },
    ]);

    // ...
};

4. React Data Grid Component

js
return (
    // set a height on the parent div because the grid fills the available space
    <div style={{ height: 500 }}>
        <AgGridReact rowData={rowData} columnDefs={colDefs} />
    </div>
);
<!-- END SETUP --> <blockquote> <p>ℹ️ <b>Note:</b></p> <span>For more information on building Data Grids with AG Grid, refer to our <a href="https://www.ag-grid.com/react-data-grid/getting-started/?utm_source=ag-grid-react-readme&utm_medium=repository&utm_campaign=githu">Documentation</a>.</span> </blockquote>

Seed Projects

We also provide Seed Projects to help you get started with common configurations:

<table width="100%"> <thead> <tr> <th>Environment</th> <th>Framework</th> </tr> </thead> <tbody> <tr> <td><a href="https://github.com/ag-grid/ag-grid-seed/tree/main/enterprise/packages/create-react-app">Create React App (CRA)</a></td> <td align="middle"></td> </tr> <tr> <td><a href="https://github.com/ag-grid/ag-grid-seed/tree/main/enterprise/packages/vite-react">Vite</a></td> <td align="middle"></td> </tr> <tr> <td><a href="https://github.com/ag-grid/ag-grid-seed/tree/main/enterprise/packages/create-next-app">Create Next App</a></td> <td align="middle"></td> </tr> <tr> <td><a href="https://github.com/ag-grid/ag-grid-seed/tree/main/enterprise/packages/vite-typescript">Vite - TypeScript</a></td> <td align="middle"></td> </tr> <tr> <td><a href="https://github.com/ag-grid/ag-grid-seed/tree/main/enterprise/packages/webpack5-typescript">Webpack 5 - TypeScript</a></td> <td align="middle"></td> </tr> <tr> <td><a href="https://github.com/ag-grid/ag-grid-seed/tree/main/enterprise/packages/webpack5-javascript">Webpack 5 - React</a></td> <td align="middle"></td> </tr> <tr> <td><a href="https://github.com/ag-grid/ag-grid-seed/tree/main/enterprise/packages/angular-cli">Angular CLI</a></td> <td align="middle"></td> </tr> <tr> <td><a href="https://github.com/ag-grid/ag-grid-seed/tree/main/enterprise/packages/nuxt-vue3">Nuxt</a></td> <td align="middle"></td> </tr> <tr> <td><a href="https://github.com/ag-grid/ag-grid-seed/tree/main/enterprise/packages/vite-vue3">Vite</a></td> <td align="middle"></td> </tr> </tbody> </table>

πŸ› οΈ 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:

To supply a custom cell renderer and filter components to the Grid, create a direct reference to your component within the gridOptions.columnDefs property:

js
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:

<table> <tr> <th>Quartz</th> <th>Material</th> </tr> <tr> <td> <a href="https://www.ag-grid.com/react-data-grid/themes/?utm_source=ag-grid-react-readme&utm_medium=repository&utm_campaign=github"> <picture> <source srcset="https://github.com/ag-grid/ag-grid/blob/latest/readme-assets/quartz-theme-light.png?raw=true" media="(prefers-color-scheme: light)"> <source srcset="https://github.com/ag-grid/ag-grid/blob/latest/readme-assets/quartz-theme.png?raw=true" media="(prefers-color-scheme: dark)">
            </picture>
        </a>
    </td>
    <td>
        <a href="https://www.ag-grid.com/react-data-grid/themes/?utm_source=ag-grid-react-readme&utm_medium=repository&utm_campaign=github">
            <picture>
                <source srcset="https://github.com/ag-grid/ag-grid/blob/latest/readme-assets/material-theme-light.png?raw=true" media="(prefers-color-scheme: light)">
                <source srcset="https://github.com/ag-grid/ag-grid/blob/latest/readme-assets/material-theme.png?raw=true" media="(prefers-color-scheme: dark)">
                
            </picture>
        </a>
    </td>
</tr>
<tr>
    <th>Alpine</th>
    <th>Balham</th>
</tr>
<tr>
    <td>
        <a href="https://www.ag-grid.com/react-data-grid/themes/?utm_source=ag-grid-react-readme&utm_medium=repository&utm_campaign=github">
            <picture>
                <source srcset="https://github.com/ag-grid/ag-grid/blob/latest/readme-assets/alpine-theme-light.png?raw=true" media="(prefers-color-scheme: light)">
                <source srcset="https://github.com/ag-grid/ag-grid/blob/latest/readme-assets/alpine-theme.png?raw=true" media="(prefers-color-scheme: dark)">
                
            </picture>
        </a>
    </td>
    <td>
        <a href="https://www.ag-grid.com/react-data-grid/themes/?utm_source=ag-grid-react-readme&utm_medium=repository&utm_campaign=github">
            <picture>
                <source srcset="https://github.com/ag-grid/ag-grid/blob/latest/readme-assets/balham-theme-light.png?raw=true" media="(prefers-color-scheme: light)">
                <source srcset="https://github.com/ag-grid/ag-grid/blob/latest/readme-assets/balham-theme.png?raw=true" media="(prefers-color-scheme: dark)">
                
            </picture>
        </a>
    </td>
</tr>
</table>

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:

<div> <a href="https://www.ag-grid.com/community/tools-extensions/"> <span>&nbsp;React</span> </a> β€’ <a href="https://www.ag-grid.com/community/tools-extensions/"> <span>&nbsp;Angular</span> </a> β€’ <a href="https://www.ag-grid.com/community/tools-extensions/"> <span>&nbsp;TypeScript</span> </a> β€’ <a href="https://www.ag-grid.com/community/tools-extensions/"> <span>&nbsp;Vue</span> </a> β€’ <a href="https://www.ag-grid.com/community/tools-extensions/"> <span>&nbsp;Python</span> </a> β€’ <a href="https://www.ag-grid.com/community/tools-extensions/"> <span>&nbsp;Svelte</span> </a> β€’ <a href="https://www.ag-grid.com/community/tools-extensions/"> <span>&nbsp;SolidJS</span> </a> β€’ <a href="https://www.ag-grid.com/community/tools-extensions/"> <span>&nbsp;.NET</span> </a> β€’ <a href="https://www.ag-grid.com/community/tools-extensions/"> <span>&nbsp;Rust</span> </a> β€’ <a href="https://www.ag-grid.com/community/tools-extensions/"> <span>&nbsp;Laravel</span> </a> </div>

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:

<picture> <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=ag-grid/ag-grid&type=Date&theme=dark"/> <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=ag-grid/ag-grid&type=Date"/> </picture>

🀝 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 [email protected].

⚠️ License

ag-grid-community is licensed under the MIT license.

ag-grid-enterprise has a Commercial license.

See the LICENSE file for more info.

<div><h2>AG Charts</h2></div>

If you've made it this far, you may be interested in our latest project: AG Charts - The best React 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.

<a href="https://www.ag-grid.com/charts/?utm_source=ag-charts-readme&utm_medium=repository&utm_campaign=github"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://github.com/ag-grid/ag-charts/blob/2ee85f286ccc151cb5e4517f711bafd03366db3c/packages/ag-charts-website/public/images/readme-assets/gallery-dark.gif?raw=true"/> <source media="(prefers-color-scheme: light)" srcset="https://github.com/ag-grid/ag-charts/blob/2ee85f286ccc151cb5e4517f711bafd03366db3c/packages/ag-charts-website/public/images/readme-assets/gallery.gif?raw=true"/> </picture> </a> <div align="right"> <a href="https://www.ag-grid.com/charts/?utm_source=ag-charts-readme&utm_medium=repository&utm_campaign=github"> </a> </div> <div align="center"> <hr/>

<strong>Follow us to keep up to date with all the latest news from AG Grid:</strong>

<a href="https://x.com/ag_grid"></a> <a href="https://www.linkedin.com/company/ag-grid/"></a> <a href="https://www.youtube.com/c/ag-grid"></a> <a href="https://blog.ag-grid.com"></a>

</div>