Checkbox

The Checkbox type generates one or more checkbox fields.

Settings

Name Type Default Required
integer (bit value) "0"
array
string check
array ["itemsProcConfig"]

default

default
Type
integer (bit value)
Default
"0"

The default value corresponds to a bit value. If you only have one checkbox having 1 or 0 will work to turn it on or off by default. For more than one checkbox you need to calculate the bit representation.

items

items
Type
array

Only necessary if more than one checkbox is desired. Contains the checkbox elements as separate array items. The label can also be defined as a LLL-reference.

Example:

items:
  - label: 'The first'
  - label: 'The second'
  - label: 'The third'
Copied!

XLF translation keys for items have the following convention:

<body>
    <trans-unit id="FIELD_IDENTIFIER.items.0.label">
        <source>Label for first Checkbox item</source>
    </trans-unit>
    <trans-unit id="FIELD_IDENTIFIER.items.1.label">
        <source>Label for second Checkbox item</source>
    </trans-unit>
    <trans-unit id="FIELD_IDENTIFIER.items.n.label">
        <source>Label for nth Checkbox item</source>
    </trans-unit>
</body>
Copied!

renderType

renderType
Type
string
Default
check
  • checkboxToggle
  • checkboxLabeledToggle

allowedCustomProperties

allowedCustomProperties
Type
array
Default
["itemsProcConfig"]

Sometimes it is needed to provide custom configuration for the itemsProcFunc functionality. These extra properties need to be explicitly allowed via this option. This option receives an array of those strings. By default, the custom option itemsProcConfig is allowed.

Examples

Minimal

name: example/checkbox
fields:
  - identifier: checkbox
    type: Checkbox
Copied!

Advanced / use case

Multiple checkboxes:

name: example/checkbox
fields:
  - identifier: checkbox
    type: Checkbox
    items:
      - label: 'The first'
      - label: 'The second'
      - label: 'The third'
    default: 2
    cols: 3
Copied!

Toggle checkbox:

name: example/checkbox
fields:
  - identifier: toggle
    type: Checkbox
    renderType: checkboxToggle
    default: 1
Copied!

Labeled toggle checkbox:

name: example/checkbox
fields:
  - identifier: toggle
    type: Checkbox
    renderType: checkboxLabeledToggle
    items:
      - label: 'Your label'
        labelChecked: 'Label checked'
        labelUnchecked: 'Label unchecked'
        invertStateDisplay: true
Copied!