Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ion-checkbox: Add disabled style #1683

Closed
ammulder opened this issue Jun 26, 2014 · 3 comments
Closed

ion-checkbox: Add disabled style #1683

ammulder opened this issue Jun 26, 2014 · 3 comments
Assignees

Comments

@ammulder
Copy link
Contributor

Similar to #541 it would be great to have an obvious "disabled" appearance for check boxes.

To see this in action, in test/html/toggle.html just add ng-disabled="isDisabled" to the two ion-checkbox elements and then use the "Disable MyModel" toggle. You can make the checkboxes disabled, but there's no visual distinction between an enabled one and a disabled one.

Further, it would be great if the corresponding text was dimmed, but I guess that's a separate issue. :)

@ammulder
Copy link
Contributor Author

FWIW, I turned disabled checkboxes grey this with the following change:

CSS:

input:disabled + .checkbox-icon:before {
    border-color: silver !important;
}
input:disabled:checked + .checkbox-icon:before {
    background-color: silver !important;
}

I went a little further and dimmed the text by changing checkbox.js to add an ng-class to the text div with a disabled style if ngDisabled was provided. Something like:

if(isDefined(attr.ngDisabled)) {
    element.find('div').eq(1).attr("ngClass",
                                   "{'text-disabled':"+attr.ngDisabled+"}");
}

And then more CSS:

.text-disabled {color: silver !important;}

@perrygovier
Copy link
Contributor

Thanks @ammulder, I'd like to implement this this as part of addressing ticket #1509

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 6, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants