You are reading the documentation for version 2.2. Magento 2.3 is the latest version available. Ensure you are reading the documentation for your version of Magento.

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 {}
  • 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
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