Skip to content

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

@mgameover

Description

@mgameover

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

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/slide-togglefeatureThis issue represents a new feature or feature request rather than a bug or bug fix

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions