Skip to main content

Adding default values to columns

You can easily add default values to new rows using the createRow prop. You can also make sure duplicated rows have default values using the duplicateRow prop.

Try adding rows, inserting rows (using Shift+Enter), or duplicating empty rows (using Ctrl+D):

Name
1
2
3
rows
<DataSheetGrid
createRow={() => ({ age: 25, date: new Date() })}
duplicateRow={({ rowData }) => ({
...rowData,
age: rowData.int ?? 25,
date: rowData.date ?? new Date(),
})}
/>