Skip to content

ImageCheck ​

The ImageCheck component renders a grid of selectable images for forms. It supports single selection (radio) and multiple selection (checkbox), with regular images or circular avatars.

Basic Usage (Single Select) ​

Bind the selected value via v-model. Single select (radio) is the default mode.

vue

<script setup>
const demoVal = ref('img1')
const imageOptions = [
  { image: '...', value: 'img1' },
  { image: '...', value: 'img2' },
  { image: '...', value: 'img3' },
  { image: '...', value: 'img4' },
]
</script>

<template>
  <TImageCheck v-model="demoVal" :options="imageOptions" />
</template>

Multiple Selection ​

Set multiple to enable checkbox mode. The bound value becomes an array.

vue

<TImageCheck v-model="selected" multiple :options="imageOptions" />

Avatar Mode ​

Use the avatar field instead of image to display circular avatar-style options.

vue

<TImageCheck v-model="selected" :options="[
  { avatar: '/f001.png', value: 'a' },
  { avatar: '/avatar.png', value: 'b' },
  { avatar: '/f001.png', value: 'c' },
  { avatar: '/f002.png', value: 'd' },
]" />

Grid Columns ​

Use cols to control the number of items per row (1-6). Items auto-arrange when cols is not set.

vue

<TImageCheck v-model="selected" :cols="4" :options="imageOptions" />

Custom Content (Slot) ​

Use the default slot with TImageCheckItem children for full control over each option. Each item must be wrapped in a div.col-auto for proper grid layout.

vue

<TImageCheck v-model="selected">
  <div class="col-auto">
    <TImageCheckItem value="s1" image="..." />
  </div>
  <div class="col-auto">
    <TImageCheckItem value="s2" avatar="..." />
  </div>
</TImageCheck>

API ​

TImageCheck Props ​

PropDescriptionTypeDefault
v-modelSelected value (any for single, array for multi)any | any[]undefined
multipleEnable multiple selection (checkbox)booleanfalse
disabledDisable all itemsbooleanfalse
nameGroup name for inputsstringundefined
colsItems per row (1-6)numberundefined
aspectRatioImage container aspect ratio, e.g. '4/3', '16/9'string'1 / 1'
optionsArray of optionsImageCheckOption[]undefined

ImageCheckOption ​

FieldDescriptionTypeDefault
imageImage URLstringundefined
avatarAvatar background image (higher priority than image)stringundefined
valueSelected valueanyimage or avatar
disabledDisable this itembooleanfalse

TImageCheckItem Props ​

PropDescriptionTypeDefault
valueOption valueany— (required)
imageImage URLstringundefined
avatarAvatar background imagestringundefined
disabledDisable this itembooleanfalse

Events ​

EventDescriptionParameters
changeEmitted when the selection changesvalue: any