AG Grid Vue 3 Component

35.2.1 · active · verified Tue Apr 21

ag-grid-vue3 is the official Vue 3 wrapper component for AG Grid, a high-performance, fully-featured, and highly customizable data grid. It enables developers to integrate the powerful AG Grid core into their Vue 3 applications, providing advanced functionalities like sorting, filtering, grouping, aggregation, and custom cell rendering. The library emphasizes outstanding performance and aims to have no direct third-party dependencies for its core grid logic, though it naturally requires Vue 3 as a peer dependency for the wrapper. It is currently at version 35.2.1, with a rapid release cadence that includes frequent patch and minor updates, and significant new features or breaking changes occurring with major version increments. Its key differentiators include its extensive feature set, superior performance, and the ability to handle large datasets efficiently without external JavaScript libraries.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to set up a basic AG Grid with Vue 3 using the AgGridVue component, define column and row data, apply a theme, and handle grid readiness.

<template>
  <div class="ag-theme-alpine" style="height: 500px; width: 100%;">
    <AgGridVue
      :columnDefs="columnDefs"
      :rowData="rowData"
      :gridOptions="gridOptions"
      @grid-ready="onGridReady"
      style="height: 100%;"
    />
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { AgGridVue } from 'ag-grid-vue3';
import type { ColDef, GridReadyEvent, GridOptions } from 'ag-grid-community';

// Import AG Grid styles
import 'ag-grid-community/styles/ag-grid.css';
import 'ag-grid-community/styles/ag-theme-alpine.css'; // Or another theme like ag-theme-quartz

const columnDefs = ref<ColDef[]>([
  { field: 'make', headerName: 'Make', sortable: true, filter: true, flex: 1 },
  { field: 'model', headerName: 'Model', sortable: true, filter: true, flex: 1 },
  { field: 'price', headerName: 'Price', sortable: true, filter: true, type: 'numericColumn' },
]);

const rowData = ref<any[]>([]);

const gridOptions: GridOptions = {
  // Example: Enable row selection
  rowSelection: 'multiple',
  animateRows: true,
  // More options as needed
};

const onGridReady = (params: GridReadyEvent) => {
  // Simulate fetching data
  rowData.value = [
    { make: 'Tesla', model: 'Model Y', price: 64950 },
    { make: 'Ford', model: 'F-Series', price: 33865 },
    { make: 'Toyota', model: 'RAV4', price: 28475 },
    { make: 'Chevrolet', model: 'Silverado', price: 34600 },
    { make: 'Honda', model: 'CR-V', price: 29500 },
    { make: 'Ram', model: 'Ram Pickup', price: 37900 },
    { make: 'GMC', model: 'Sierra', price: 39500 }
  ];
  params.api.sizeColumnsToFit();
};
</script>

<style scoped>
/* Scoped styles are generally not used for global AG Grid themes,
   but can be used for wrapper element styles or custom cell renderers. */
</style>

view raw JSON →