title: Formatting checkboxes with Bootstrap in Rails form erb?
body: <p>I'm using multiple check boxes in my Rails views form. I'm using Bootstrap 4 for styling. If there is a Bootstrap style for checkboxes like: </p>
  
  <pre><code>&lt;div class="input-group mb-3"&gt;
    &lt;div class="input-group-prepend"&gt;
      &lt;div class="input-group-text"&gt;
        &lt;input type="checkbox" aria-label="Checkbox for following text input"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;input type="text" class="form-control" aria-label="Text input with checkbox"&gt;
  &lt;/div&gt;
  
  &lt;div class="input-group"&gt;
    &lt;div class="input-group-prepend"&gt;
      &lt;div class="input-group-text"&gt;
        &lt;input type="radio" aria-label="Radio button for following text input"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;input type="text" class="form-control" aria-label="Text input with radio button"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>how do I implement multiple class stylings into an erb object? Here is the code I'm trying to implement: </p>
  
  <pre><code>            &lt;%= f.collection_check_boxes(:authorization_ids, Authorization.all, :id, :auth_name, { checked: @account.try { |a| a.authorization_ids.map(&amp;:to_param) } }, multiple: true, # WOULD LIKE TO IMPLEMENT BOOTSTRAP CLASSES HERE ) %&gt;
          &lt;%= f.label :authorization_ids, 'Authorizations' %&gt;
  
  </code></pre>
  
  <p><strong>UPDATE</strong> </p>
  
  <p>Some great responses here. I ended up using <code>bootstrap_form_with</code> from the 
  <code>rails_bootstrap_form</code> Gem. I used a custom wrapper class for styling and was able to get the checkboxes in nice orderly columns and rows. </p>
  
  <pre><code>&lt;div class="container"&gt;
      &lt;div class="col"&gt;
          &lt;div class="row justify-content-center"&gt;
              &lt;div class='form-group'&gt;
                  &lt;%= bootstrap_form_with(model: @account) do |f| %&gt;
                  &lt;%= f.text_field :account_name %&gt;
                  &lt;%= f.text_field :account_address_line1 %&gt;
                  &lt;%= f.text_field :account_address_line2 %&gt;
                  &lt;%= f.text_field :account_city %&gt;
                  &lt;%= f.select :account_state, states %&gt;
                  &lt;%= f.text_field :account_zipcode %&gt;
                  &lt;%= f.text_field :contact_first_name %&gt;
                  &lt;%= f.text_field :contact_last_name %&gt;
                  &lt;%= f.email_field :contact_email %&gt;
                  &lt;%= f.telephone_field :contact_phone %&gt;
                  &lt;%= f.select :account_ppu, ppu, placeholder: "Select PPU...." %&gt;
                  &lt;%= f.text_area :account_notes %&gt;
              &lt;/div&gt;
  
              &lt;%= f.collection_check_boxes :authorization_ids, Authorization.all, :id, :auth_name, hide_label: true, wrapper: {class: "cp-container-class"} %&gt;
          &lt;/div&gt;
          &lt;%= f.submit 'Create' %&gt;
          &lt;% end %&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Styling: </p>
  
  <pre><code>@import "bootstrap";
   @import "rails_bootstrap_forms";
   @import url('https://fonts.googleapis.com/css?family=Baloo+Thambi+2|Lato&amp;display=swap');
  
   body {
       margin: 0px;
   }
  
  
  #logo {
       margin: 1em;
       padding: 1em;
       width: 500px;
       height: auto;
  
   }
  
   .cp-container-class {
       width: 1000px;
       height: 500px;
       justify-items: center; 
      flex-direction:column;
        padding: 10px;
       /* Change to whatever*/
       display: flex;
       flex-wrap: wrap;
       border: black 1px solid;
   }
  
   .cp-container-class&gt;* {
       flex: 1 1 20px; 
       margin-left: 50px; 
       letter-spacing: 5px;
  
   }
  
  </code></pre>