rinku
8/19/2019 - 8:18 PM

checkbox group

<template>
    
    <lightning-checkbox-group name="Checkbox Group"
                              label="" variant="label-hidden"
                              options={checkBoxOptions}
                              value={valueCheckBox}>

    </lightning-checkbox-group>

</template>
/* eslint-disable no-console */
/* eslint-disable vars-on-top*/
/* eslint-disable guard-for-in*/

import { LightningElement, api } from 'lwc';

export default class CheckBoxCmp extends LightningElement {
    @api mapCheckboxOptions = [];
    @api valueCheckBox = [];
    @api optionsCheckBox = [];

    get checkBoxOptions () {
        var checkOptions = [];
        if (this.optionsCheckBox.length !== 0) {
           for (var key in this.optionsCheckBox) {
            checkOptions.push({label : this.optionsCheckBox[key], value : this.optionsCheckBox[key]});
           }
        }

        return checkOptions;
    }
}