How to output 'selected' checkbox labels within a matrix Newbie here.

First Craft 3 CMS build and fumbling with logic of Matrix blocks.

I've created a relatively simple matrix field, and I can output plain text and dropdown options, but not sure how to do a multiple choice field like checkboxes within a matrix.

Thanks
You'd use the checkbox fields much the same way they would be used if they were added directly to the entry and not in the matrix field. Assuming you've got a basic matrix field structure (using if/else or switch):

{% for block in entry.myMatrixField.all() %}

    {% switch block.type %}

        {% case "text" %}

            {{ block.textField | markdown }}

        {% case "image" %}

            {{ block.image[0].getImg() }}

        {% case "checkboxes" %}

            // HELP!!!

        {% default %}

            &lt;p&gt;A font walks into a bar.&lt;/p&gt;
            &lt;p&gt;The bartender says, “Hey, we don’t serve your type in here!”&lt;/p&gt;

    {% endswitch %}

{% endfor %}


You could use the same examples that are in the docs and just switch entry for the name of your block variable (block in our case):

Loop through the checked checkboxes:

{% for option in block.checkboxFieldHandle %}
    Label: {{ option.label }}
    Value: {{ option }} or {{ option.value }}
{% endfor %}


Loop through all of the available checkboxes:

{% for option in block.checkboxFieldHandle.options %}
    Label:   {{ option.label }}
    Value:   {{ option }} or {{ option.value }}
    Checked: {{ option.selected ? 'Yes' : 'No' }}
{% endfor %}


See if any checkboxes are checked:

{% if block.checkboxFieldHandle|length %}


See if a particular checkbox is checked:

{% if block.checkboxFieldHandle.contains('optionValue') %}