components icon indicating copy to clipboard operation
components copied to clipboard

mat-button-toggle styling issues

Open fad250 opened this issue 7 years ago • 6 comments

Bug 1:

Issue

Applying custom style for checked button toggle gives an odd hover effect.

eg.

.mat-button-toggle-checked{
  background-color: #2979FF;
  color: white;
} 

button-toggle-bug

What are the steps to reproduce?

https://stackblitz.com/edit/angular-ivjb9g

Bug 2:

Issue

In legacy style, button elevation cannot be modified.

What are the steps to reproduce?

https://stackblitz.com/edit/angular-ivjb9g-tdqden

fad250 avatar Jan 04 '19 12:01 fad250

Does anybody know a temporary fix? :)

wottpal avatar Mar 24 '19 18:03 wottpal

Does anybody know a temporary fix? :)

A bit ugly hack, but works

::ng-deep .mat-button-toggle-appearance-standard:not(.mat-button-toggle-disabled):hover .mat-button-toggle-focus-overlay {
    opacity: 0 !important;
}

skobak avatar Jul 02 '20 18:07 skobak

I find mat-button-toggle the worst component of Angular Material.

blogcraft avatar Jan 04 '21 18:01 blogcraft

I find mat-button-toggle the worst component of Angular Material.

It is as if they literally wanted to make it horrible.

tawani avatar Apr 03 '21 00:04 tawani

For bug 1: The problem is in color: white, you have to set it on .mat-button-toggle-checked button to avoid it. Unfortunately it works only with ::ng-deep. https://stackblitz.com/edit/angular-ivjb9g-sse7ch On the other hand such overrides should be a part of your custom material theme, so just put it in your theme.scss:

.mat-button-toggle {
    button {
        color: mat-color($color-primary);
    }
}
.mat-button-toggle-checked {
    background-color: mat-color($color-primary);

    button {
        color: #fff;
    }
}

zzeneg avatar Sep 21 '21 18:09 zzeneg

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.