I am using @aws-amplify/ui-react package for Auth.
I want to override a few CSS classes that come with it. The package heavily uses the CSS variables but I am not able to override them.
For example, I want to add the add border-radius to the button. I tried overriding the .button class in CSS files but it is not taking effect.
Following is how the DOM looks like.
I tried doing the following CSS but it does not seem to work.
amplify-button{
border-radius: 6px;
}
.button{
border-radius: 6px;
}
Any clue how to achieve this?
That's because it is using a
shadow DOM
, you can't directly overwrite the elements/styles by changing the css, you'll need to inject the css into the shadow DOMAnother alternative is if the component you are using exposes
css path attribute
orcss variables
and then you could set them in yourstyle
element.From the github library issues, they mention this problem, https://github.com/aws-amplify/amplify-js/issues/2471, with this example solution:
Which would override the variables:
amplify-font-family
andamplify-primary-color
.