-
Notifications
You must be signed in to change notification settings - Fork 6.8k
bug(icon-button): The backwards compatability mixin for color variants is not affecting icon buttons #29146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for pointing this out! In M3, you need to use a backwards compatability mixin to get that same code to work. See our docs for how to use it. Let me know if that solves this issue for you! I'll update this issue to track removing the color inputs for the component specific documentation. |
I understand that we should use the backwards compatibility mixin for setting the theme. However, the issue is that the Honesty, I already setup M3 system with custom theme in my workspace, but only |
Check this: #29151. Starting from that answer, here's what I did and works well: For a primary icon button, I defined:
For a warn one, I defined a whole warn theme and similarly to the above, a class .warn. It works well and does not use the m2 color attributes at all, neither the backwards compatibility mixin. Usage: Hope it helps! |
Not sure if 100% related, but I think it is: Found it a bit confusing in the API section when trying to style my The |
@cuzo989874 Thanks for pointing out that the icon-button variant is missing. I took a closer look and yes that example does have the backwards compatability mixin but it isn't affecting icon buttons. I'll change the title for this issue accordingly. In the meantime, you can add custom styles for your icon buttons if necessary or do what @banut1 suggested. The CSS variable
Note: You can also directly access the color roles from the theme itself with @midthun I agree, we are updating our docs for the different components page to make this more clear. Thanks! |
Here is my temporary solution. If anyone has the same situation, you can follow this: :root {
.mat-primary {
--mdc-icon-button-icon-color: #{variables.$primary-color};
--mat-icon-button-state-layer-color: #{map.get(palette.$primary, 70)};
}
.mat-accent {
--mdc-icon-button-icon-color: #{variables.$accent-color};
--mat-icon-button-state-layer-color: #{map.get(palette.$tertiary, 70)};
}
.mat-warn {
--mdc-icon-button-icon-color: #{variables.$error-color};
--mat-icon-button-state-layer-color: #{map.get(map.get(palette.$primary, error), 70)};
}
} |
This was fixed by #29433. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Documentation Feedback
In the previous version (Angular/Material 17), the color of the mat-icon-button could be customized. However, I am currently unable to access the code or obtain the correct demo version, even though the parameter still exists on the API page.
Affected documentation page
https://material.angular.io/components/button/overview#button-overview
The text was updated successfully, but these errors were encountered: