0

I am trying to implement a tri-state checkbox using LWC input type=checkbox element and I am trying to set HTML 5 indeterminate attribute https://html.spec.whatwg.org/multipage/input.html#checkbox-state-(type%3Dcheckbox) but looks like it is not supported, should I change lightning:input to html basic input?

<lightning-input type="checkbox" variant="label-hidden" indeterminate={checkboxmodel.indeterminate} checked={checkboxmodel.checked}></lightning-input>

This page has an error. You might just need to refresh it. [Unknown public property "indeterminate" of element . This is likely a typo on the corresponding attribute "indeterminate".]

3

Indeterminate is not a content attribute, as per the documentation, it cannot be used in the component's markup

In addition to the checked and unchecked states, there is a third state a checkbox can be in: indeterminate. This is a state in which it's impossible to say whether the item is toggled on or off. This is set using the HTMLInputElement object's indeterminate property via JavaScript (it cannot be set using an HTML attribute):

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox

  • it doesn't allow me to switch to html input, it claims that it doesn't support standard indeterminate attribute for html input – Patlatus Apr 13 at 12:30
  • O.o, I see, it doesnt look like indeterminate is actually a content attribute, so, you cant declare it in the markup – glls Apr 13 at 12:36

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.