Skip to content

ACV Checkbox

Checkbox is a control that allows to select binary state, either checked or unchecked. Also, it can support indeterminate state, which is used to represent a checkbox with a state that is neither checked nor unchecked. Used in cases where a list of two or more parameters is mutually exclusive, that is, the user can select only one parameter.

Basic usage

value: false

Source code
vue
<script setup>
  import AcvCheckbox from '@/components/checkbox/checkbox.vue';
  import { reactive, ref } from 'vue';

  const isAgreed = ref(false);
  const checked = reactive([true, false, true, false]);
</script>

<template>
  <div class="flex flex-col mt-6">
    <AcvCheckbox v-model="isAgreed">
      I am agreed to terms and conditions
    </AcvCheckbox>
    <p class="mt-2">
      value: {{ isAgreed }}
    </p>
  </div>

  <div class="acv-grid-row acv-grid--cols-4 mt-6">
    <AcvCheckbox
      v-model="checked[0]"
      label="Checked"
    />
    <AcvCheckbox
      v-model="checked[1]"
      label="Unchecked"
    />
    <AcvCheckbox
      v-model="checked[2]"
      label="Disabled and checked"
      disabled
    />
    <AcvCheckbox
      v-model="checked[3]"
      label="Disabled"
      disabled
    />
  </div>
</template>

Disabled

Indeterminate

Accessibility

Provided AcvCheckbox component must adapt to the list of WAI-ARIA accessibility patterns.

It should:

  • able to navigate to the checkbox using the keyboard;
  • clicking or tapping should change the state of the checkbox;
  • it should be focusable;
  • in multiple checkboxes, it should be clearly distinguishable from other checkboxes;

Aldo

Props

Prop nameDescriptionTypeValuesDefault
cycleIndeterminateEnable cycling indeterminate stateboolean-
indeterminateValueCustom value for indeterminate state of the CheckboxCheckboxModelValue-null
uncheckedValueValue of the Checkbox if it's not checkedCheckboxModelValue-false
checkedValueValue of the Checkbox if it's checkedCheckboxModelValue-true
modelValueBind v-model valueCheckboxModelValue-
idTitle of the Checkboxstring-
labelLabel text inside default slotstring-
disabledWhether the Checkbox is disabledboolean-false
nameNative name attributestring-
showHintShow browser's default title hintboolean-false
multilineLabelEnables multiline labelboolean-false
multilineLabelLimitLimit the number of lines of the labelnumber-
sizeSize of the CheckboxComponentSize'small', 'medium', 'large''medium'
colorColor of the CheckboxColorProp'primary', 'secondary', 'success', 'info', 'warning', 'error''primary'
invalidboolean-
requiredboolean-
iconClassClasses for the icon elementstring-

Events

Event namePropertiesDescription
update:modelValueeventName string - The name of the event
value any - The updated value
Triggered when binding value changes
update:indeterminateeventName string - The name of the event
value boolean - Indeterminate state value
Triggered when indeterminate state changes

Slots

NameDescriptionBindings
iconSlot for checkbox icon
defaultDefault slot for rendering checkbox label

MIT Licensed