Check

UI renderless check group component

Import

import { Check, CheckBox, CheckGroup, CheckList } from  'mand-mobile-next'

Vue.createApp().component(Check.name, Check)
Vue.createApp().component(CheckBox.name, CheckBox)
Vue.createApp().component(CheckGroup.name, CheckGroup)
Vue.createApp().component(CheckList.name, CheckList)

Code Examples

API

Check Props

PropsDescriptionTypeDefaultNote
nameunique nameanytrue-
v-modelselected nameanyfalse-
labeloption textString--
disabledwhether disable selection or notBooleanfalse-
iconicon name of checked optionsStringchecked-
icon-inverseicon name of unchecked optionsStringchecke-
icon-disabledicon name of disabled optionsStringcheck-disabled-
icon-svguse svg iconBooleanfalse-
sizesize of iconStringmd-
icon-positionicon positionStringright-

CheckBox Props

PropsDescriptionTypeDefaultNote
nameunique nameanytrue-
v-modelselected nameanyfalse-
disabledwhether disable selection or notBooleanfalse-

CheckGroup Props

Check multiple checks. Combine with Check or CheckBox.

PropsDescriptionTypeDefaultNote
v-modelselected namesArray--
maxmax selected name lengthNumber00: no limit

CheckGroup Methods

check(name)
ArgDescriptionTypeDefault
namename will be selectedString-
uncheck(name)
ArgDescriptionTypeDefault
namename will be unselectedString-
toggle(name)
ArgDescriptionTypeDefault
namename will be toggleString-
toggleAll(checked?: Boolean)

Select All or Deselect (disabled options will not be changed)

ArgDescriptionTypeDefault
checkedselect all or noneBooleanreverse election if empty

CheckList Props

ArgDescriptionTypeDefaultNote
v-modelselected namesArray--
optionsdata otpionsArray<{text, value, disabled, ...}>[]-
iconicon of selected optionStringchecked-
icon-inverseicon of unselected optionsStringcheck-
icon-disabledicon of disabled optionsStringcheck-disabled-
icon-sizethe size of iconStringmd-
icon-svguse svg iconBooleanfalse-
icon-positionthe position of iconStringrightleft, right
is-slot-scopeif it is mandatory to use slot-scopeBoolean-it depends on exact cases to determine whether to use it or not, and avoids adding if/else to component

CheckList Slots

CheckGroup default slot will be used as template, and it will receive {option} from slot-scope.

<template>
  <md-check-list :options="data">
    <template slot-scope="{ option, index, selected }">
      <div class="custom-title" v-text="option.text"></div>
      <div class="custom-brief">{{ option.text }} custom description</div>
    </template>
  </md-check-list>
</template>