Skip to content

Checkbox

ECheckbox enables users to pick an option by ticking a checkbox to indicate their preference, and toggle between checked, unchecked, and optional indeterminate states. Demo Here

Usage

vue

<template>
  <ECheckbox v-model="isChecked">Checkbox</ECheckbox>
</template>

<script setup>
  const isChecked = ref(false);
</script>

Props

For ECheckbox component, the following props are available:

PropTypeDefaultNote
idString-HTML id attribute.
disabledBooleanfalseDisables the ECheckbox content.
messageString-Adds a message below the checkbox.
modelValueBooleanfalseIf true, the element is checked.
trueValueString-Value of the checkbox if it's checked.
falseValueString-Value of the checkbox if it's unchecked.
validateOnString"input"Triggers validation on @values: submit, input.
nameString-HTML name attribute.
rulesArray-Validation rules. For more info refer to Form Validation.
sizeString"md"The ECheckbox element has three predefined sizes: sm, md, lg.
indeterminateBooleanfalseDisplays a state separate from either checked or unchecked. It only controls the style.
trueIconObject-Displays a true icon when the checkbox is checked. More Info here.
falseIconObject-Displays a false icon when the checkbox is unchecked. More Info here.
colorString"primary"The given color is applied to the element - utility colors are supported (e.g primary or danger). you'll find a list of built-in classes on the src/styles/_vars.scsspage.
stateString-Validates the user-provided data against established criteria and performs display validation. States can be none if no validation is necessary, danger if the selected is valid, or success if it is acceptable.
squareBooleanfalseRemoves rounded corners of the element.

Emits

The ECheckbox component contains following emits.

EmitDescription
update:modelValueControls the checked status of the element.

Slots

The ECheckbox component provides a default slot that enable you to customize the content.

SlotDescription
defaultThe default Vue slot.
infoAdds an info to the checkbox (Can't change the checked state onClick).

COPYRIGHT