<% yield %> <% form ||= current_fields_form single_check_box ||= false multiple ||= false option_field_options ||= {} append_class ||= '' labels = labels_for(form, method) if form # Since we don't know at this point which tag we'll be using, we specify # the class only once here for simplicity and apply it to one of the following tags: # 1. form.check_box # 2. check_box # 4. form.radio_button # # the `append_class` local can be used to append any other styles desired for the element. option_field_options[:class] ||= "focus:ring-blue h-4 w-4 text-blue border-slate-300 dark:bg-slate-800 dark:border-slate-900 #{"rounded" if multiple || single_check_box}" option_field_options[:class] += " #{append_class}" %> <% if single_check_box %> <% if form %>
<%= form.check_box method, option_field_options %> <%= form.label method, class: 'ml-2' %>
<% else %> <% value = option_field_options.delete(:value) %> <% checked = option_field_options.delete(:checked) %> <%= check_box_tag method, value, checked, option_field_options %> <% end %> <% else %> <% options.each do |value, label| %> <% end %> <% end %>