I would like to change the standard color of the toggle in lightning input when it is checked or not. How can I perform it?

.THIS .slds-checkbox_faux
    background-color: #ec54d4 !important;

In this way, it will be changed every checkbox. Additionally, how can I distinguish the color when it is checked or not? I tried .slds-checkbox_off but it seems doesn't work

.slds-checkbox_toggle [type=checkbox]:checked+.slds-checkbox_faux_container .slds-checkbox_faux{
    border-color: red!important;
    background-color: red!important;

Should work! You can distinguish it with the checked property of the slds-checkbox_toggle. Following properties will be added only if the checkbox was also checked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.