# Multiple master checkboxes in the statements component

## Single master checkbox

By default, the statements component is displayed with one master checkbox. Regardless of the number of controls, such a checkbox selects them all.

<div align="center"><img src="https://content.gitbook.com/content/2CssJT0zIo4SJQLbSZ6l/blobs/7iY6LDu5sFqkqCABSevk/10s_files/image2025-9-1_14-19-38.png" alt="Figure 1. Example appearance of statements with a single master checkbox for one control
(depending on the implementation, the appearance may vary)" width="563"></div>

<figure><img src="https://2112972046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2CssJT0zIo4SJQLbSZ6l%2Fuploads%2FtMrMUBWkblOTYYAmE61y%2FPrzechwycenie%20obrazu%20ekranu_2017-07-20_10-42-30.png?alt=media&#x26;token=6f81c80b-188e-49d3-a632-200b031f2603" alt="" width="494"><figcaption><p align="center"><em><strong>Figure 2.</strong> Example appearance of the component with a single master checkbox for two controls</em><br><em>(depending on the implementation, the appearance may vary)</em></p></figcaption></figure>

## Multiple master checkboxes

To display two or more master checkboxes, first define them by clicking **Add masterCheckbox** in the **MASTER CHECKBOX LIST** (masterCheckboxes).

![Figure 3. MasterCheckbox list window with a defined list of two main checkboxes](https://content.gitbook.com/content/2CssJT0zIo4SJQLbSZ6l/blobs/VMZwY9sFjbnwfynsd1dE/10s_files/image2024-8-5_14-18-36.png)

{% stepper %}
{% step %}

#### Define master checkboxes

For each master checkbox, define:

* mastercheckboxId — The ID that will identify the master checkbox for the controls
* labelKey — The text key that will be displayed for the master checkbox with the specified ID
* visibleCondition — The visibility condition of the master checkbox. Default value: "true".
  {% endstep %}

{% step %}

#### Link the master checkbox to a control

To link a master checkbox to a control, enter the master checkbox ID in the control definition. Appropriate entries must be added in the component JSON (more about creating statements in [Statements Editor](https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/formularze/biblioteka-komponentow-bazowych/7-komponenty-specjalne/oswiadczenia-statements/edytor-oswiadczen)).

Example (JSON fragment) showing the addition of master checkboxes "mCh1" and "mCh2" for statements:

{% code title="fragment.json" %}

```json
"items": [
    {
        "controls": [
            {
                "mid": "kontolka1",
                "titleKey": "kontrolka1",
                "requiredCondition": "js:false",
                "mastercheckbox": "mCh1",
                "type": "CHECKBOX"
            },
            {
                "mid": "kontolka2",
                "titleKey": "kontrolka2",
                "requiredCondition": "js:false",
                "notSelectedErrorTextKey": "",
                "mastercheckbox": "mCh2",
                "type": "CHECKBOX"
            }
        ]
    }
]
```

{% endcode %}
{% endstep %}
{% endstepper %}

![Figure 4. Example statements with three master checkboxes
(depending on the implementation, the appearance may vary).](https://content.gitbook.com/content/2CssJT0zIo4SJQLbSZ6l/blobs/zjkADLJhhGfWloAqBGG8/10s_files/image2018-10-11_9-29-41.png)

When only one master checkbox is visible, the statements will look as shown below. The master checkbox key will not be displayed; instead, a default description will appear. In this case, the behavior of the master checkbox does not change and it still selects only those controls that have the parameter **mastercheckbox** indicating its ID — in other words, this master checkbox does not select all controls.

![Figure 5. Example statements with one visible master checkbox
(depending on the implementation, the appearance may vary).](https://content.gitbook.com/content/2CssJT0zIo4SJQLbSZ6l/blobs/PUNFzSBQPdKVcQGRhEpy/10s_files/image2018-10-11_10-15-45.png)
