Skip to content

VegaCheckbox ​

Customizable Checkbox Input Component

This component provides a customizable checkbox input with support for custom colors, size, label positioning, and more. It works seamlessly with v-model and is styled using CSS variables for easy theming.

Basic Example ​

vue
<template>
  <vega-checkbox
    v-model="isChecked"
    label="I agree to the terms"
    checked-color="var(--vp-custom-block-success-bg)"
    border-color="var(--vega-gray)"
    checkbox-size="20px"
    label-position="right"
    label-gap="10px"
  />
</template>

<script setup>
import { ref } from 'vue'
import VegaCheckbox from 'vega-ui'

const isChecked = ref(false)
</script>

Props ​

Prop nameTypeDefaultDescription
model-valueboolean | string | number—Current value of the checkbox. Used with v-model.
checked-valueboolean | string | numbertrueValue considered as "checked".
unchecked-valueboolean | string | numberfalseValue considered as "unchecked".
checked-colorstringvar(--vega-primary)Background and border color when the checkbox is checked.
border-colorstringvar(--vega-border-color)Border color in unchecked state.
labelstring""Label text displayed next to the checkbox.
label-positionstring"right"Position of the label relative to the checkbox: top, bottom, left, or right.
label-gapstring"6px"Gap between the checkbox and the label.
checkbox-sizestring"16px"Size of the checkbox.
readonlybooleanfalseIf true, disables interaction with the checkbox.

Events ​

Event NameDescription
update:modelValueEmitted when the checkbox value changes.

Slots ​

The component does not use any named slots directly, but allows customization through props and CSS.