{% if widget.optgroups %}
{% with id=widget.attrs.id %}
<div class="field-row {{ widget.attrs.class }}" {% if id %}id="{{ id }}"{% endif %}>
  {% for group, options, index in widget.optgroups %}
  {% if group %}
  <div class="field-col col4">
    <ul class="">
      <li><label class="w-field__label">{{ group }}</label>
        {% endif %}
        <ul {% if id %}id="{{ id }}_{{ index }}"{% endif %}>
          {% for option in options %}
          <li>{% include option.template_name with widget=option %}</li>
          {% endfor %}
        </ul>
        {% if group %}
      </li>
    </ul>
  </div>
  {% endif %}
  {% if forloop.counter|divisibleby:3 %}
  <div style="clear:both;"></div>
  {% endif %}
  {% endfor %}
  <div style="clear:both;"></div>
</div>
{% endwith %}
{% else %}
{% load i18n wagtailadmin_tags %}
<div>
    <a class="button button-small button-secondary chooser__choose-button" href="{% url "wagtailsnippets_wagtail_feathers_"|add:widget.model_name|lower|add:":add" %}">
{#        {% icon name="plus-inverse" classname="default w-mr-2.5 w-align-middle" %}#}
        {% icon name="plus-inverse" classname="icon" %}
        {% trans "Add " %}{{ widget.model_name }}
    </a>
</div>
{% endif %}