Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReactJS / Material-UI / Javascript: Can't get rounded borders on TableRow

I'm trying to get rounded borders on TableRow. I've added style "borderRadius: 5" but it doesn't do anything. When I surround TableRow by Box with borderRadius, it does work but then the table spacing is broken.

I've been messing around with this for a while but can't figure out.. What's the best solution for this?

<Table>
<TableRow style={{ borderRadius: 5, backgroundColor: "green" }}>
    <TableCell>
        First table cell
    </TableCell>
    <TableCell>
        Second table cell
    </TableCell>
    <TableCell>
        Third table cell
    </TableCell>
</TableRow>
</Table>
like image 932
SJ19 Avatar asked Jun 18 '26 21:06

SJ19


1 Answers

Try add the css in the cell level like below,

.MuiTableRow-root td:first-child {
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

.MuiTableRow-root td:last-child {
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

Working code - https://codesandbox.io/s/recursing-wing-t8xke?file=/src/App.js

like image 64
Sarun UK Avatar answered Jun 21 '26 11:06

Sarun UK