One data grid for JavaScript, React, Vue & Angular. Sorting, filtering, virtualization, pinning, and CSV export included. Early access $199 $349 → [Get it now]

How to handle checkboxes in Vue

Handling checkbox inputs is essential for building interactive forms, settings panels, and selection interfaces in Vue applications. As the creator of CoreUI, a widely used open-source UI library, I’ve implemented checkbox controls in countless Vue components. From my expertise, the most effective approach is using the v-model directive, which provides automatic two-way data binding between checkbox state and component data. This creates reactive forms that update immediately when users interact with checkboxes.

Use v-model to bind checkbox state to reactive data properties.

<template>
  <input type="checkbox" v-model="isChecked" />
  <p>{{ isChecked }}</p>
</template>

<script>
export default {
  data() {
    return { isChecked: false }
  }
}
</script>

Here v-model="isChecked" creates two-way binding between the checkbox and the isChecked data property. When users check or uncheck the box, Vue automatically updates the data property. The paragraph displays the current boolean value, demonstrating the reactive connection between UI state and component data.

Best Practice Note:

This is the same checkbox handling pattern we use in CoreUI Vue components for settings and form controls. For multiple checkboxes with the same name, bind to an array with v-model to collect all selected values automatically.


Speed up your responsive apps and websites with fully-featured, ready-to-use open-source admin panel templates—free to use and built for efficiency.


About the Author

Subscribe to our newsletter
Get early information about new products, product updates and blog posts.
How to declare the optional function parameters in JavaScript?
How to declare the optional function parameters in JavaScript?

How to Merge Objects in JavaScript
How to Merge Objects in JavaScript

How to round a number to two decimal places in JavaScript
How to round a number to two decimal places in JavaScript

How to check if a string is a number in JavaScript
How to check if a string is a number in JavaScript

Answers by CoreUI Core Team