Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change color of radio button in angular material 2

I'm struggling with the next problem. I'm trying to change the color of the angular material 2 radio button on PROPER way, without overriding css. By default, it uses accent color of the material theme, but I want to use the primary.

Other components have color property like checkbox, button, etc...

Thanks in advance.

like image 814
Igor Janković Avatar asked Mar 01 '17 10:03

Igor Janković


People also ask

How to write radio button in angular?

Set Radio Button Selected in Angular It will set selected value of radio button in Angular's Reactive Forms. registrationForm = this. fb. group({ gender: ['male'] // Pass the name value in form control array. })

What is mat radio button?

<mat-radio-button> is used to select one option when we have multiple options. Approach: First, install the angular material using the above-mentioned command. After completing the installation, Import 'MatRadioModule' from '@angular/material/radio' in the app.


1 Answers

In case anyone else stumbles across this issue, you can now use the color property on MatRadioButton components. Here is the link to the GitHub issue where I was corrected:

  • https://github.com/angular/material2/issues/9439
like image 87
th3n3wguy Avatar answered Sep 23 '22 08:09

th3n3wguy