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 DOM
const style = document.createElement('style');
style.innerHTML = '.the-class-name { property-name: my-value; }';
host.shadowRoot.appendChild( style );
// The host is the parent component in your DOM that contains
// the shadow DOM element.
const host = document.getElementById('host');
Another alternative is if the component you are using exposes css path attribute
or css variables
and then you could set them in your style
element.
From the github library issues, they mention this problem, https://github.com/aws-amplify/amplify-js/issues/2471, with this example solution:
@import '../css/app'
amplify-authenticator
display: flex
justify-content: center
align-items: center
height: 100vh
font-family: 'Raleway', 'Open Sans', sans-serif
min-width: 80vw
padding: 10vmin
@media only screen and (min-device-width: 700px)
margin: auto
padding: 15vmin
min-width: 100%
--amplify-font-family: $typography-font-family
--amplify-primary-color: #FA3336
Which would override the variables: amplify-font-family
and amplify-primary-color
.