If records property points to an empty array, the DataTable component will indicate its empty state by displaying a customizable icon and text, like so:
Name
Email
No records
Make sure to set a minHeight large enough to accommodate the icon and text when dealing with empty state in non “vertically-scrollable” tables.
return(
<DataTable
minHeight={150}
records={[]}
// ...
/>
);
You can modify the displayed text by setting the noRecordsText property:
Name
Email
No records to show
return(
<DataTable
minHeight={150}
records={[]}
noRecordsText="No records to show"
// ...
/>
);
The icon can also be modified by setting the noRecordsIcon property: