2

I am just wondering if there is any way to style md-checkbox like given below:

Codepen code for input checkbox

Note: I just wanna change the border color of the checkbox.

I have tried following way but didn't succeed :

SCSS

$dal-green: #45ba8e;
    .check{
    md-checkbox {
      border: 2px solid $dal-green; 
    }
    }

HTML :

     <div class="check"> 
<md-checkbox></md-checkbox>
</div>

I have searched online but no luck . If any body can give css to override the border color it would be great help. Thanks In advance.

1
  • it seems <md-checkbox> creates <div class='md-icon' /> which defaults to an unchecked box area. Try applying css to this .md-icon I learnt it from here, github.com/angular/material/issues/2832 (the last comment) Commented Jun 23, 2015 at 20:15

3 Answers 3

2

Try this,

.check{
md-checkbox {
  border: 2px solid #009688; 
}
}
Sign up to request clarification or add additional context in comments.

2 Comments

Its not working color is not a problem here assigning color to the border of the checkbox.
it seems <md-checkbox> creates <div class='md-icon' /> which defaults to an unchecked box area. Try applying css to this .md-icon I learnt it from here, github.com/angular/material/issues/2832 (the last comment)
0

Try something like this :

md-checkbox .md-icon {
  border-color: green;
}

Comments

0

in new version you should use with underscore _md-icon:

        md-checkbox.md-checked ._md-icon {
         background-color: transparent;
        }


        md-checkbox ._md-icon {
        border-color: white;
        }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.