bug(button-toggle): Mixin does not support color variants
- Lenguaje dominante
- TypeScript
- Estrellas
- 25k
- Forks
- 6.8k
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 91
Descripción
### 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
According to [documentation](https://material.angular.io/guide/theming#using-component-color-variants), the MatButtonToggle component can be stylized using 4 color variants:
> | Component | Supported $color-variant values | Default |
> |--------|--------|--------|
> | Button-toggle | primary, secondary, tertiary, error | secondary |
But when I use the mixin `@include mat.button-toggle-color(theme.$light-theme, $color-variant: primary);` I get the following error:
```
"Invalid color variant: primary. Mixin does not support color variants."
╷
123 │ token-utils.get-tokens-for($tokens, tokens-mat-standard-button-toggle.$prefix, $options...);
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
node_modules\@angular\material\button-toggle\_button-toggle-theme.scss 123:7 -theme-from-tokens()
node_modules\@angular\material\button-toggle\_button-toggle-theme.scss 38:5 color()
src\styles.scss 36:2 root stylesheet
```
### Reproduction
Setup a regular Material 3 project and copy/paste:
```
@use '@angular/material' as mat;
:root {
@include mat.button-toggle-theme($theme);
@include mat.button-toggle-color($theme, $color-variant: primary);
}
```
Replace `$theme` with a M3 theme.
### Expected Behavior
All styles for color variant should be included.
### Actual Behavior
Error is thrown.
### Environment
- Angular: 18.1.3
- CDK/Material: 18.1.3
Guía de contribución
Línea de trabajo
Comienza con el mixin color() de button-toggle y las ubicaciones de _button-toggle-theme.scss que se muestran en el stack trace; después reproduce la configuración de M3 del issue usando src/styles.scss. Sigue cómo se valida la opción $color-variant. Se considera terminado cuando la variante primary compila e incluye los estilos de button-toggle esperados sin el error invalid-variant.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- angular, sass
- Área
- frontend
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 52/100