Dedicated Vue.js Checkbox Component
Ivan Dwijaya
183

Hi Ivan Dwijaya. On your “I can’t pass optional attributes like id , disabled , required without specifying a props for each possible attribute.”: You actually can. Vue passes all default arguments to the root element of your component. If you want to change that behaviour, you can. By setting inheritAttrs to `false` and setting `v-bind=”$attrs”` on your `<input type=”checkbox”>` inside your component template, all attributes are passed to the input element.

More on inherit attributes: https://vuejs.org/v2/guide/components-props.html#Disabling-Attribute-Inheritance

Like what you read? Give Warre Buysse a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.