{% with id=widget.attrs.id %}
    <div{% if id %} id="{{ id }}"{% endif %} class="flex gap-2 {% if radio_style == 1 %} flex-row gap-4{% else %} flex-col{% endif %}">
        {% for group, options, index in widget.optgroups %}
            {% if group %}
                <div>
                    <label>{{ group }}</label>
            {% endif %}

            {% for option in options %}
                <div class="form-check">
                    {% include option.template_name with widget=option %}
                </div>
            {% endfor %}

            {% if group %}
                </div>
            {% endif %}
        {% endfor %}
    </div>
{% endwith %}
