v7.3.0

CheckboxGroup
Widget

A container for a set of related Checkbox widgets, allowing the user to select multiple options from the group. Provide the choices via the convenient options shorthand or as individual Checkbox child items. The group's value reflects the array of checked checkbox values and can be read from a parent container's values. Enforce selection limits with requiredSelectedOptions, minSelectedOptions, and maxSelectedOptions.

const checkboxGroup = new CheckboxGroup({
    appendTo : document.body,
    title    : 'Select cities',
    name     : 'cities',
    value    : 'London',
    options  : {
        London    : 'London',
        Madrid    : 'Madrid',
        Stockholm : 'Stockholm',
        Sydney    : 'Sydney'
    }
});

Useful configs and properties

Config / Property Description
options Object mapping values to display labels
name Name used when reading/writing container values
inline Display checkboxes horizontally instead of vertically
value Array of checked checkbox values
requiredSelectedOptions Minimum required selections for validation

The name config is required for this widget, and it will be assigned to all checkboxes created by processing the options config.

Vertical or horizontal layout

The default orientation is vertical, but you can change it to horizontal by setting the inline config to true.

Disabled

Validation

You can set requiredSelectedOptions, minSelectedOptions and maxSelectedOptions to force users to select the right amount of options.

See also

  • Checkbox - Individual checkbox widget
  • RadioGroup - Similar group widget for single-selection radio buttons
  • FieldSet - Base fieldset container
No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class

Properties

Properties are getters/setters or publicly accessible variables on this class

Events

Events are triggered for certain actions in this class and can be listened for to react to those actions in your code

Event handlers

Event handlers are callbacks called as a result of certain actions in this class
type: checkboxGroup

Source path

Core/widget/CheckboxGroup.js

Contents