Checkbox is an extension to standard checkbox element with theming.

import Checkbox from 'primevue/checkbox';

Binary checkbox is used as a controlled input with v-model and binary properties.

<Checkbox v-model="checked" :binary="true" />

Multiple checkboxes can be grouped together.

<div class="card flex flex-wrap justify-content-center gap-3">
    <div class="flex align-items-center">
        <Checkbox v-model="pizza" inputId="ingredient1" name="pizza" value="Cheese" />
        <label for="ingredient1" class="ml-2"> Cheese </label>
    <div class="flex align-items-center">
        <Checkbox v-model="pizza" inputId="ingredient2" name="pizza" value="Mushroom" />
        <label for="ingredient2" class="ml-2"> Mushroom </label>
    <div class="flex align-items-center">
        <Checkbox v-model="pizza" inputId="ingredient3" name="pizza" value="Pepper" />
        <label for="ingredient3" class="ml-2"> Pepper </label>
    <div class="flex align-items-center">
        <Checkbox v-model="pizza" inputId="ingredient4" name="pizza" value="Onion" />
        <label for="ingredient4" class="ml-2"> Onion </label>

Checkboxes can be generated using a list of values.

<div v-for="category of categories" :key="category.key" class="flex align-items-center">
    <Checkbox v-model="selectedCategories" :inputId="category.key" name="category" :value="" />
    <label :for="category.key">{{ }}</label>

Invalid state is displayed using the invalid prop to indicate a failed validation. You can use this style when integrating with form validation libraries.

<Checkbox v-model="checked" invalid binary />

Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.

<Checkbox v-model="checked" binary variant="filled" />

When disabled is present, the element cannot be edited and focused.

<Checkbox v-model="checked" disabled />

Screen Reader

Checkbox component uses a hidden native checkbox element internally that is only visible to screen readers. Value to describe the component can either be provided via label tag combined with inputId prop or using aria-labelledby, aria-label props.

<label for="chkbox1">Remember Me</label>
<Checkbox inputId="chkbox1" />

<span id="chkbox2">Remember Me</span>
<Checkbox aria-labelledby="chkbox2" />

<Checkbox aria-label="Remember Me" />

Keyboard Support

tabMoves focus to the checkbox.
spaceToggles the checked state.