# Multiple master checkboxes in the statements component

## Single master checkbox

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

<div align="center"><img src="/files/540effe34b35d9afa6c3b103d0848ade3931f299" alt="Illustration 1. Example appearance of declarations with one master checkbox for one control
(depending on the implementation, the appearance may differ)" width="563"></div>

<figure><img src="/files/9aff8823784a97a6d1e64830698437ff6bc874b9" alt="" width="494"><figcaption><p align="center"><em><strong>Figure 2.</strong> Example appearance of the component with one master checkbox for two controls</em><br><em>(depending on the implementation, the appearance may differ)</em></p></figcaption></figure>

## Multiple master checkboxes

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

![Illustration 3. MasterCheckbox list window with a defined list of two main checkboxes](/files/7846c826b2512ddb1887de03afcf5004b625ff93)

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

#### Associate the master checkbox with a control

To associate a master checkbox with a control, enter the master checkbox ID in the control definition. Add the appropriate entries in the component JSON (more about creating declarations in [Declarations Editor](/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/formularze/biblioteka-komponentow-bazowych/7-komponenty-specjalne/oswiadczenia-statements/edytor-oswiadczen.md)).

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

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

![Illustration 4. Example declarations with three master checkboxes
(depending on the implementation, the appearance may differ).](/files/6b3e1c4824b05aa4499a7ab3cc40bc15727f36e2)

When only one master checkbox is visible, the declarations will look as below. The master checkbox key will not be displayed; instead, the 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.

![Illustration 5. Example declarations with one visible master checkbox
(depending on the implementation, the appearance may differ).](/files/38d8f266f8e1bbce0a8aa102fd87c3fee2418a0c)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/formularze/biblioteka-komponentow-bazowych/7-komponenty-specjalne/oswiadczenia-statements/wiele-master-checkboxow-w-komponencie-oswiadczen.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
