Skip to content

Checkbox ​

Drawn with view on the Mini Program

The native checkbox component is not used (MP styles are not controllable); instead the checkbox is drawn with view + a lh-icon glyph, keeping the visuals consistent with the other builds of the family.

Basic usage ​

vue
<template>
  <lh-checkbox v-model="checked" label="Agree to the terms" />
</template>

<script setup lang="ts">
import { ref } from 'vue'
const checked = ref(false)
</script>

Checkbox group ​

vue
<template>
  <lh-checkbox-group v-model="values">
    <lh-checkbox value="a" label="Option one" />
    <lh-checkbox value="b" label="Option two" />
    <lh-checkbox value="c" label="Option three" disabled />
  </lh-checkbox-group>
</template>

<script setup lang="ts">
import { ref } from 'vue'
const values = ref(['a'])
</script>

Indeterminate state ​

vue
<lh-checkbox v-model="checked" indeterminate label="Select all (partially selected)" />

Checkbox Props ​

PropDescriptionTypeDefault
modelValue (v-model)Whether it is checkedbooleanfalse
valueThe identifying value inside a groupunknown—
labelTextstring—
disabledDisabledbooleanfalse
indeterminateIndeterminate statebooleanfalse
nameNative namestring—
sizeSize'small' | 'medium' | 'large'—
customClassCustom class namestring—
sxQuick layout propsLhSxProps—

CheckboxGroup Props ​

PropDescriptionTypeDefault
modelValue (v-model)Array of checked valuesunknown[][]
disabledDisable all childrenbooleanfalse
nameNative namestring—
sizeSize (passed down to the children)'small' | 'medium' | 'large'—

Events ​

EventDescriptionCallback parameters
update:modelValueValue changed(value)
changeValue changed(value)