carbon-components-vue icon indicating copy to clipboard operation
carbon-components-vue copied to clipboard

[CvCheckbox] doesn't work without a value

Open TimonLukas opened this issue 3 years ago • 1 comments

Detailed description

Using a cv-checkbox requires a value prop, even in use cases where no value is used. I frequently use cv-checkboxes with v-model, and to do so I have to feed an empty value prop to keep the component from complaining.

Steps to reproduce the issue

  1. Create a checkbox with v-model but without value: <cv-checkbox label="Some label" v-model="checkboxValue"/>
  2. See that an error is thrown because the value prop is required. The component still works as expected, and the model value is updated correctly.
  3. Add the value prop with any string value, e.g. <cv-checkbox label="Some label" v-model="checkboxValue" value=""/>
  4. The error isn't thrown anymore, but functionally there is no difference.

If you're short on time I'd be glad to implement this, I didn't open a PR because the change is in a mixin, and I haven't had time to look into where that is used. In that case Slack me :)

TimonLukas avatar Mar 10 '21 12:03 TimonLukas