Data grid
EuiDataGrid is for displaying large amounts of tabular data. It is a better choice over
EUI tables when there are many columns, the data in those columns is fairly uniform, and when schemas and sorting are important for comparison. Although it is similar to traditional spreedsheet software, EuiDataGrid's current strengths are in rendering rather than creating content.Core concepts
- The grid allows you to optionally define an in memory level to have the grid automatically handle updating your columns. Depending upon the level chosen, you may need to manage the content order separately from the grid.
- Schemas allow you to tailor the render and sort methods for each column. The component ships with a few automatic schema detection and types, but you can also pass in custom ones.
- Unlike tables, the data grid forces truncation. To display more content your can customize popovers to display more content and actions into popovers.
- Grid styling can be controlled by the engineer, but augmented by user preference depending upon the features you enable.
- Control columns allow you to add repeatable actions and controls like checkboxes or buttons to your grid.
- The toolbar offers the user ways to manipulate the display and order of the data.
Top level props
The below table contains a list of all top level EuiDataGrid props and sample snippets used to configure or customize them.
For a full list of all data grid types, including lower level configurations, see the /datagrid/data_grid_types.ts definition file, or view the props tables of individual datagrid sub-pages.
Prop | Sample snippet |
---|---|
Prop rowCount The total number of rows in the dataset (used by e.g. pagination to know how many pages to list). | Sample snippet
|
Prop columns An array of #EuiDataGridColumn objects. Lists the columns available and the schema and settings tied to it. | Sample snippet
|
Prop leadingControlColumns An array of #EuiDataGridControlColumn objects. Used to define ancillary columns on the left side of the data grid. Useful for adding items like checkboxes and buttons. | Sample snippet
|
Prop trailingControlColumns An array of #EuiDataGridControlColumn objects. Used to define ancillary columns on the right side of the data grid. Useful for adding items like checkboxes and buttons. | Sample snippet
|
Prop columnVisibility An array of #EuiDataGridColumnVisibility objects.
Defines which columns are intitially visible in the grid and the order they are displayed.
Users can still turn their visibility on/off when | Sample snippet
|
Prop onColumnResize A callback for when a column's size changes. Callback receives | Sample snippet
|
Prop schemaDetectors An array of custom #EuiDataGridSchemaDetector objects. You can inject custom schemas to the grid to define the classnames applied. | Sample snippet |
Prop renderCellValue A function called to render a cell's value. Behind the scenes it is treated as a React component allowing hooks, context, and other React concepts to be used. The function receives #EuiDataGridCellValueElementProps as its only argument. | Sample snippet
|
Prop cellContext An optional object of props passed to the | Sample snippet
|
Prop renderCellPopover An optional function that can be used to completely customize the rendering of cell popovers. If not specified, defaults to an Behind the scenes it is treated as a React component allowing hooks, context, and other React concepts to be used. The function receives #EuiDataGridCellPopoverElementProps as its only argument. | Sample snippet
|
Prop renderFooterCellValue An optional function called to render a footer cell. If not specified, no footer row is rendered. Behind the scenes it is treated as a React component allowing hooks, context, and other React concepts to be used. The function receives #EuiDataGridCellValueElementProps as its only argument. | Sample snippet
|
Prop renderCustomToolbar An optional function called to customize placement of controls in EuiDataGrid's toolbar. This can be used to add custom buttons or reorder existing ones. Behind the scenes, this function is treated as a React component, allowing hooks, context, and other React concepts to be used. It receives #EuiDataGridCustomToolbarProps as its only argument. | Sample snippet
|
Prop renderCustomGridBody An optional function called to completely customize and control the rendering of EuiDataGrid's body and cell placement. This can be used to, e.g. remove EuiDataGrid's virtualization library, or roll your own. This component is only meant as an escape hatch for extremely custom use cases. Behind the scenes, this function is treated as a React component, allowing hooks, context, and other React concepts to be used. It receives #EuiDataGridCustomBodyProps as its only argument. | Sample snippet
|
Prop pagination A #EuiDataGridPaginationProps object. Omit to disable pagination completely. | Sample snippet
|
Prop sorting A #EuiDataGridSorting object that provides the sorted columns along with their direction. Provides a callback for when it changes.
Optional, but required when inMemory is set.
Omit to disable, but you'll likely want to also turn off the user sorting controls through the | Sample snippet
|
Prop inMemory A #EuiDataGridInMemory object to define the level of high order schema-detection and sorting logic to use on your data. Try to set when possible. If omitted, disables all enhancements and assumes content is flat strings. | Sample snippet
|
Prop toolbarVisibility Allows you to configure what features the toolbar shows. Accepts either a boolean or #EuiDataGridToolBarVisibilityOptions object. When used as a boolean, defines the display of the entire toolbar. When passed an object allows you to turn off individual controls within the toolbar as well as add additional buttons. | Sample snippet
|
Prop minSizeForControls Defines a minimum width for the grid to show all controls in its toolbar. | Sample snippet
|
Prop gridStyle Defines the initial style of the grid. Accepts a partial #EuiDataGridStyle object.
Settings provided may be overwritten or merged with user defined preferences if | Sample snippet
|
Prop rowHeightsOptions A #EuiDataGridRowHeightsOptions object that provides row heights options.
Allows configuring both default and specific heights of grid rows.
Settings provided may be overwritten or merged with user defined preferences if | Sample snippet
|
Prop | Sample snippet
|
Prop virtualizationOptions Allows customizing the underlying react-window grid props. | Sample snippet
|