Skip to main content

Checkbox

Description​

<jp-checkbox> is a form component with multi <input type="checkbox"> functionality.


Attributes​

NameRequiredTypeDescription
valueArray<string> or comma separated stringsetter
options✓Array<{ label?: string; value:
boolean; checked?: boolean;
disabled?: boolean }>
List of checkboxes
requiredbooleandetermines if an input is required
requiredValidationMessagestringvalidation message for when component does not satisfy required
minSelectsnumberminimum number of checks allowed
minselectsValidationMessagestringvalidation message for when component does not satisfy minSelects
maxSelectsnumbermaximum number of checks allowed
maxselectsValidationMessagestringvalidation message for when component does not satisfy maxSelects
validationMessages{[type]: string} where type is stringcompact way of writing validation messages in a single attribute


Slots​

This component does not have any slots.



Methods​

  • getValue
    • returns form field value
  • reportValidity
    • triggers reportValidity


Events​

  • value
    • triggers when one of the checkboxes changes value


Demo​

Live Editor
// import '@jaspero/web-components/checkbox.wc.js';
// import '@jaspero/web-components/checkbox.css';

<jp-checkbox options='[
    {"value": "aaa", "label": "aaa"},
    {"value": "lorem aa", "label": "lorem aa"},
    {"value": "lorem adasda", "label": "lorem adasda"}
]'></jp-checkbox>
Result
Loading...