Skip to content

Data Grid - Row definition

Define your rows.

Feeding data

The rows can be defined with the rows prop, which expects an array of objects.

Press Enter to start editing

Row identifier

Each row must have a unique identifier.

This identifier is used internally to identify the row in the various models—for instance, the row selection model—and to track the row across updates.

By default, the Data Grid looks for a property named id in the data set to get that identifier.

If the row's identifier is not called id, then you need to use the getRowId prop to tell the Data Grid where it's located.

The following demo shows how to use getRowId to grab the unique identifier from a property named internalId:

function getRowId(row) {
  return row.internalId;

<DataGrid getRowId={getRowId} />;

If no such unique identifier exists in the data set, then you must create it by some other means, but this scenario should be avoided because it leads to issues with other features of the Data Grid.

Note that it is not necessary to create a column to display the unique identifier data. The Data Grid pulls this information directly from the data set itself, not from anything displayed on the screen.

Styling rows

You can check the styling rows section for more information.