Comments (10)
Okay, I just pushed a new commit over the old one with it working. All I needed to do was add 'disabled' to the classNameBindings in the labeled-radio-button.js.
I've added a test for it as well.
As for a general strategy for altering classes on the label, I'm not sure! It would be handy though.
from ember-radio-button.
I'm definitely interested in having a clean way for users to control what classes show up on the label (and even the input element) in different disabled
and other states.
I'm curious why what you attempted first did not work... it sounds like it should have. Asking people to modify the wrapInLabel...
method is not a good answer to this request.
Let's discuss and see if we can think of a direction to take this.
from ember-radio-button.
Here's my fork, the latest commit shows what I added. https://github.com/Allovue/ember-radio-button
from ember-radio-button.
I have just run into this problem. I don't want the normal 'round' radio buttons, but instead each radio button is a styled label that has an on/off style change. The radio-button itself is set to display:hidden
. It works great except for the fact that I cannot provide a class directly to the label.
It seems that whenever this component builds a radio with a label, the label class is always fixed to:
class="ember-view ember-radio-button"
Would adding a labelClass property work? Just like the radioClass does?
from ember-radio-button.
A workaround I have managed for now is to use this idea from the readme:
"When radioId is specified, the label tag's for attribute will also use it."
So I specify the radioId using a bound attribute from the model, which then gives that same value to the label.
Then I can target the label when it is 'checked' like this:
label[for=<my value>].checked {
background-color: red;
}
It means that I need to target all the labels for each of the possible values, which is somewhat hacky. It would be better if we could just target the checked labels, by using labelClass=x.
from ember-radio-button.
@rmcsharry We would welcome a PR supporting labelClass
from ember-radio-button.
I wanted to do this too, and was thinking I'd have to buckle down and learn about writing add-ons so I could create a PR, but isn't the goal accomplished by just using the non-block form of radio-button
and wrapping it with an actual HTML label
?
<label class="btn btn-default">
{{radio-button
value="Green"
groupValue="status"
changed="changeStatus"}}
Green
</label>
from ember-radio-button.
@jdhines I think I agree with you but not sure what that code snippet is showing
from ember-radio-button.
@raycohen just showing that if you need a label around the radio with a class, just use an HTML <label>
rather than using the block format of radio-button
. Silly obvious now that I think about it; I just get tunnel-vision sometimes as I'm still trying to find my way with Ember.
from ember-radio-button.
Closing as I believe updates to the README help show that you can use the non-block form of radio-button
, and then you can have full control over your own label
element
from ember-radio-button.
Related Issues (20)
- make keyboard navigable according to WCAG-A
- DEPRECATION: `hasBlock` is deprecated. Use `has-block` instead. HOT 4
- Where is Version 3 for Ember. 3.16? on EmberObserver? HOT 6
- Trying to upgrade to newer version
- multiple depreciations detected in 2.0.1
- `aria-checked` not being set on `master` branch HOT 3
- Changes on master have not yet been released HOT 22
- groupValue Documentation a bit confusing HOT 1
- Error: You cannot use `attributeBindings` on a tag-less component HOT 4
- <input> field isn't including a correct "value" attribute in the DOM in IE11
- autofocus attribute not supported HOT 1
- groupValue not updated on button deselect HOT 6
- Allow specifying a label using inline invocation HOT 3
- CRUD : Edit does not retain previous value HOT 2
- Upgrade ember-cli-htmlbars to remove deprecation warning HOT 3
- Question: What is this syntax in render of a test HOT 3
- aria-checked not used?
- Replace sendAction with closure actions HOT 10
- Remove `labeled-radio-button`
- How do I add data attributes to radio-button ? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-radio-button.