FEATURE REQUEST: Add color input to MatRadioGroup and MatRadioButton components
Bug, feature request, or proposal:
- Feature Request
What is the expected behavior?
- There should be a way to change the color of the
<mat-radio-button>element without having to do a "hacky" CSS-workaround.
What is the current behavior?
- In order to change the color on the
<mat-radio-button>element, you have to override the CSS being set on them. Here is an example of the currently "hacky" CSS-workaround:
What are the steps to reproduce?
- Attempt to use the
color="primary"or other property on either a<mat-radio-button>or<mat-radio-group>element. This property does not exist as an input to either of those elements.
What is the use-case or motivation for changing an existing behavior?
- To allow a developer to change the color of the radio buttons based on UX/UI designs.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
- The only testing I have done is with the following info:
- Angular: 5.2.0
- Material: 5.0.4
- TypeScript: 2.4.2
- OS: Windows 10
- Browsers:
- Chrome: 63.0.3239.132
Is there anything else we should know?
- Not that I am aware of.
The color attribute is available on the <mat-radio-button> element.
https://github.com/angular/material2/blob/60b0625667dbba070c217764aea6daa5fe19e3bc/src/lib/radio/radio.ts#L322-L333
Can you please provide a demo that shows your issue?
Closing as color is already available on MatRadioButton. A working version can be seen here
Thank you very much @DevVersion and @josephperrott. I am not quite sure what I was doing wrong in my project, so I appreciate the information!
How to change the radio button color in the 7 version
This pattern works in ng6 and 7 :smile:
https://stackoverflow.com/a/52569008/1747267
Note the !important isn't necessary for it to work
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.