Checkbox

Checkbox control

Parameters you can pass

ParametersData typeDescription
namestringInput name to be used in a form
valuestringInput value
idstringInput ID
textstringText by the checkbox
class_namestringWrapper class (you can pass several of them)
input_class_namestringInput class
text_class_namestringText label class (if it was passed)
checkedboolIt shows if it's checked
disabledboolIt shows if it's disabled
smallboolIt shows if it's smaller than usual

Unchecked (default)

self.render({ ref: '/tmpl/controls/checkbox.twig' }, {
    name: 'checkbox',
    class_name: 'checkbox-wrapper-classname',
    input_class_name: 'checkbox-input-classname'
  }); 

Checked

self.render({ ref: '/tmpl/controls/checkbox.twig' }, {
  name: 'checkbox',
  checked: true
});

Disabled

self.render({ ref: '/tmpl/controls/checkbox.twig' }, {
  name: 'checkbox',
  disabled: true
});

Checked Disabled

self.render({ ref: '/tmpl/controls/checkbox.twig' }, {
  name: 'checkbox',
  checked: true,
  disabled: true
});

Checkbox with text

self.render({ ref: '/tmpl/controls/checkbox.twig' }, {
  name: 'checkbox',
  text: 'Would you like to sign up for newsletters?',
  text_class_name: 'checkbox-text-classname'
});

Small checkbox with text

self.render({ ref: '/tmpl/controls/checkbox.twig' }, {
  name: 'checkbox',
  text: 'Would you like to sign up for newsletters?',
  text_class_name: 'checkbox-text-classname',
  small: true
});