Reputation: 5077
So I am experimenting with React Material UI Tables. I am trying to set auto with property for the columns but it does not expand as expected. Here I wanted the columns to be fully extended and not wrapped.
I tried to add property in the <Table size="small" style={{ width: auto}}>
but it does not respond. Also, I am afraid it would be a bad practice if I set value by pixel value here?
Is there a better way to set individual columns by percentage or some other flexible types? or table as a whole?
Upvotes: 0
Views: 894
Reputation: 4954
Just set white-space: "nowrap"
for th
. Here's the changes based on your code:
const StyledTableCell = withStyles((theme: Theme) =>
createStyles({
root: {
whiteSpace: "nowrap"
},
head: {
backgroundColor: theme.palette.common.black,
color: theme.palette.common.white
},
body: {
fontSize: 14
}
})
)(TableCell);
Upvotes: 1