Skip to content
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

bug(MatSlideToggle): MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS doesn't provide ability to set default color #22012

Closed
mgameover opened this issue Feb 24, 2021 · 1 comment · Fixed by #22047, cayacdev/cashbox#88, ToWipf/jasmarty#155 or CarlosPavajeau/Kaizen#251
Assignees
Labels
area: material/slide-toggle feature This issue represents a new feature or feature request rather than a bug or bug fix P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@mgameover
Copy link

Reproduction

There is no way to set default color for MatSlideToggle component at application level.

Expected Behavior

It would be great to have ability to set default color in the same way as it is implemented for MatCheckBox or MatRadioButton:

providers: [
  { provide: MAT_CHECKBOX_DEFAULT_OPTIONS, useValue: { color: 'primary' } },
  { provide: MAT_RADIO_DEFAULT_OPTIONS, useValue: { color: 'primary' } },
],

Actual Behavior

MatSlideToggleDefaultOptions has no color property. 'accent' value is hardcoded, please checkout slide-toggle.ts#75

mixinTabIndex(mixinColor(mixinDisableRipple(mixinDisabled(MatSlideToggleBase)), 'accent'));

Environment

  • CDK/Material: ^11.2.0
@mgameover mgameover added the needs triage This issue needs to be triaged by the team label Feb 24, 2021
@crisbeto crisbeto self-assigned this Feb 26, 2021
@crisbeto crisbeto added area: material/slide-toggle feature This issue represents a new feature or feature request rather than a bug or bug fix has pr P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed needs triage This issue needs to be triaged by the team labels Feb 26, 2021
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 26, 2021
… globally

Allows for the `color` of a slide toggle to be configured through a provider.

Fixes angular#22012.
wagnermaciel pushed a commit that referenced this issue Mar 2, 2021
… globally (#22047)

Allows for the `color` of a slide toggle to be configured through a provider.

Fixes #22012.
@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 Apr 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.