Skip to content

bug(M3-Buttons): missing color variants #29151

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

Closed
1 task
banut1 opened this issue May 30, 2024 · 3 comments
Closed
1 task

bug(M3-Buttons): missing color variants #29151

banut1 opened this issue May 30, 2024 · 3 comments
Assignees
Labels
needs triage This issue needs to be triaged by the team

Comments

@banut1
Copy link

banut1 commented May 30, 2024

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

Missing color-variant error for mat-fab:
image

Usage:

.danger {
  @include mat.fab-color($theme, $color-variant: error);
}

Error on any kind of color-variant for mat-icon-button:
image

Usage:

.danger {
  @include mat.icon-button-color($theme, $color-variant: primary);
}

Reproduction

https://stackblitz.com/edit/67r7jk?file=src%2Ftheme.scss

Expected Behavior

all color variants work for all components

Actual Behavior

different errors in different use cases

Environment

  • Angular: 18.0.1
  • CDK/Material: 18.0.1
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows
@banut1 banut1 added the needs triage This issue needs to be triaged by the team label May 30, 2024
@crisbeto
Copy link
Member

The color variants are defined by the Material spec which doesn't include an error variant. The way to do it would be to define a theme with your error colors and pass it to mat.button-theme like:

button.error-variant {
  @include mat.button-theme($your-error-theme);
}

@crisbeto crisbeto self-assigned this May 31, 2024
@banut1
Copy link
Author

banut1 commented May 31, 2024

I have generated the color palette with ng generate @angular/material:m3-theme, and it has generated an error palette alongside with primary, tertiary, secondary, neutral. I don't have an entire theme for the error colors, just that palette.

Can this be achieved for icon buttons and fabs without defining a whole error theme and just using the error colors from $theme?

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs triage This issue needs to be triaged by the team
Projects
None yet
Development

No branches or pull requests

2 participants