material-web
material-web copied to clipboard
[mwc-button] outlined button --mdc-theme-primary will also set button text color
[mwc-button] outlined button --mdc-theme-primary will also set button text color, using --mdc-theme-on-primary won't set the text color. eg:
<body>
<style>
mwc-button[outlined] {
--mdc-theme-primary: yellow;
--mdc-theme-on-primary: black;
--mdc-button-outline-color: red;
}
</style>
<mwc-button outlined label="Button" unelevated></mwc-button>
<mwc-button outlined label="Button"></mwc-button>
</body>
The button text is controlled by --mdc-theme-primary; and at unelevated state, the whole button will be yellow, with no text shown. I want an outlined unelevated button with different background color and text color.
this will be my goal
this will be my goal
@chxx-v you can override the CSS vars in your button element through the style attribute or via CSS class:
<mwc-button style="--mdc-theme-primary: black;"></mwc-button>
@maicol07 but when the option is selected, it will fill the whole background with black color, no text can be read...
Fixed in M3