I created a table with Material UI v5 and now when the mouse pointer hovered on the table row I want to add a blue border to the table row.
I have tried a lot of ways and searched but I did not find any solution.
this is what I made so far:
Advertisement
Answer
You can check the online example here: https://codesandbox.io/s/reverent-faraday-6jb5yt
I did this:
JavaScript
x
15
15
1
const StyledTableRow = styled(TableRow)(({ theme }) => ({
2
"&:nth-of-type(odd)": {
3
backgroundColor: theme.palette.action.hover
4
},
5
"&:last-child td, &:last-child th": {
6
border: 0
7
},
8
'&:hover': {
9
border: '3px solid blue'
10
},
11
[`&.${tableRowClasses.root}`]: {
12
borderRadius: "100px"
13
}
14
}));
15
Specifically, including on StyledTableRow
these lines:
JavaScript
1
4
1
'&:hover': {
2
border: '3px solid blue'
3
},
4