{% for group, options, index in widget.optgroups %}
  <div class="btn-group" role="group" aria-label="Trade Acceptance State">
  {% for option in options %}
    <label class="btn btn-outline-primary {% if option.selected %}btn-active{% endif %}">
      <input type="radio" name="{{ widget.name }}" value="{{ option.value }}"
             {% for attr, val in option.attrs.items %} {{ attr }}="{{ val }}" {% endfor %}
             autocomplete="off" style="display:none;"
             {% if option.selected %} checked {% endif %}>
      {{ option.label }}
    </label>
  {% endfor %}
  </div>
{% endfor %} 