I need to change this white background Image Ref
<DataGrid
rows={users}
columns={columns}
disableColumnMenu={true}
hideFooter={true}
loading={isLoading}
autoHeight={true}
sx={{
boxShadow: 2,
border: 2,
borderColor: "#292524",
"& .MuiDataGrid-cell": {
color: "white",
borderColor: "#292524",
},
"& .MuiDataGrid-columnHeader": {
backgroundColor: "#0c0a09",
color: "#75706c",
}
}}
/>
& .MuiDataGrid-columnHeader
changes the color, but only of inner header cells
2
Answers
mui concider blank space as a filler not as a column header, so You need to change color of MuiDataGrid-filler class also
The DOM hierarchy is:
You must change the background of the
<div role="row"
inside theMuiDataGrid-columnHeaders
to change the background of the whole header row area.Otherwise, you must change the background of
MuiDataGrid-filler
class along with your previous code. (Not Recommended)