I want to customize the styling of my <Dialog>
component by adding rounded corners using a border radius. Here is the inline style I am trying to apply to override the default styles of the <Dialog>
:
let overrideStyles = {
padding: 0,
margin: 0,
borderRadiusTopLeft: '4px',
borderRadiusTopRight: '4px',
};
The <Dialog>
component in Material UI offers different possibilities for customizing internal styles, such as bodyStyle
, contentStyle
, style
, titleStyle
, overlayStyle
, and actionsContainerStyle
. I decided to apply these styles to each one individually.
<Dialog
bodyStyle={overrideStyles}
contentStyle={overrideStyles}
style={overrideStyles}
titleStyle={overrideStyles}
overlayStyle={overrideStyles}
actionsContainerStyle={overrideStyles}
modal={overrideStyles}
>
<TestPanel/>
</Dialog>
However, when I render my TestPanel
, the result does not have the rounded corners as expected:
https://i.stack.imgur.com/LXt4X.png
After inspecting the elements, I noticed a particular div where the border radius was not applied:
https://i.stack.imgur.com/N8RMT.png
If I add the border radius to this highlighted div, the corners will be properly rounded. This raises the question...
How can I effectively override the default styles of Material UI's <Dialog>
component to achieve the desired rounded corner effect?