Checkbox component

The Checkbox component implements a form field that is an HTML <input type="checkbox"> element. It can also be displayed as a “toggle” handler or a radio button element.

Configuration options

Option Description Type Default
checked Initial checkbox state (selected or cleared). If false, the checkbox is cleared. If true, the checkbox is selected. Boolean false
multiple Renders multiple elements. Boolean false
prefer The input type of the element to be rendered. Can be either radio button, checkbox, or toggle key. Changing this value also changes the elementTmpl, originally defined in the parent (abstract) component. String checkbox
valueMap Convert the component's value to the expected type. For example, you can set to convert '0' to 'false', this would look like following:
{
'0': false
}
Object {}
templates
  • radio
  • checkbox
  • toggle
Paths to templates for all possible types of input elements. The exact template to be used for rendering is defined by the prefer property. Object
  • String
  • String
  • String
ui/form/components/single/radio
ui/form/components/single/checkbox
ui/form/components/single/switcher
component The path to the component’s .js file in terms of RequireJS. String Magento_Ui/js/form/element/single-checkbox
template The path to the component’s .html template. String ui/form/field