Checkbox

  • It is a checkbox.

Features/Functionality

  • Click functionality on checkbox.
  • Sets a boolean value in inputMdl.
  • Component is container responsive.
  • It is cross browser compatible. (IE11, Edge, Firefox, chrome).

Basic Usage

Dependencies

HTML Structure

<require from="{user_path}/checkboxes/checkbox"></require>
<cst-checkbox label.bind="{label}" input-mdl.bind="{inputMdl}" options.bind="{options}" other-info.bind="{otherInfo}" ext-disabled.bind="{disabled}" evt-click-callback.bind="{evtClickCallback}"></cst-checkbox>

Bindable Properties

PropertyData TypeRequiredDescription
labelstringNoLabel to be shown.
inputMdlbooleanNoVariable where initial data will be given and set.
optionsobjectNoBasic component options
otherInfoanyNoExtra info to be passed on event
extDisabledbooleanNoDisables any functionality on component.
evtClickCallbackmethodNoMethod to be called on click event.

Structure of bindable properties

options

options = {
pageLabel: {}, // Override page labels
pageColorData: {} // Override css colour property
}

evtClickCallback

evtClickCallback(_event,_info);
_info = {
overrideContext: overrideContext,
otherInfo: otherInfo,
value: true/false
}

CSS Overriding

  • Following classes are given to override CSS:
    • .cst-checkbox-container-override : Container Class
    • .cst-checkbox-element-override: Element Class

Note

  • While giving the classes in page, give them in nested structure.

Rules

  • Bind events with jquery if bind method is given.
  • Use disabled property as external property so that change can be handled.
  • Do not use classes as bindable properties, Instead give a class overridable class name to div which we want to override and in page give the class inside the component div.
  • Always keep overridable, id and label property in options.
  • In Js file, the bindable properties names are changed.

Component measurements

Image of measurements

** box-sizing: border-box is used. So width and height will be dimensions + padding.

Working Example

HTML

<template>
<require from="./components/checkboxes/checkbox"></require>
<div>
<cst-checkbox label.bind="label" input-mdl.bind="inputMdl" options.bind="options" other-info.bind="otherInfo" ext-disabled.bind="disabled" evt-click-callback.bind="evtClickCallback"></cst-checkbox>
</div>
</template>

CSS

.cst-ex-checkbox {
.cst-checkbox-element-override {
padding-right: 40px !important;
}
.cst-checkbox-container-override{
justify-content: center !important;
}
}

JS

class MyCls{
constructor(){
this.otherInfo = {
qId : '1'
}
this.label = 'Label';
this.inputMdl = {};
this.options = {};
this.disabled = false;
}
evtClickCallback(_event,_info){
console.log(_event);
console.log(_info);
}
}
export { MyCls }

Example Screen Shots

Desktop

Image of Ex


IE Desktop

Image of Ex


Tab

Image of Ex


Mobile

Image of Ex


Demo Link
Demo


Mark down usage
https://guides.github.com/features/mastering-markdown/

VersionDateDeveloped ByInformation ClassificationReviewed ByApproved By
1.016-10-2019TarunINTERNALGunjan and PrasanPrasan