Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49087

How do I limit amount of boxes the user can check when using ion-checkbox? (Vue)

$
0
0

Hi, I am trying to limit the amount of checked boxes the user can input. Here is my code:

      <ion-item v-for="category in randomCategories" v-bind:key="category">
        <ion-label color="light">{{category.val}}</ion-label>
        <ion-checkbox
          @update:modelValue="category.isChecked = $event"
          :modelValue="category.isChecked" (ionChange)="onChange($event)" >
        </ion-checkbox>
      </ion-item>

Currently, the user gets presented with 5 options, of which they should only be able to select 3 total. How do I make this happen? If they have already chosen 3, they need to uncheck one to select a different one. Any help is greatly appreciated.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 49087

Trending Articles