Core Form Builder

Rails form builder with just for form fields. No error messages, no labels, no hints.

Example

<%= form_with url: root_path, class: "form", data: { controller: "fields" }, builder: FormBuilders::CoreFormBuilder do |f| %>
  <div class="flex flex-col gap-4">
    <div class="grid gap-x-4 md:grid-cols-2">
      <%= f.text_field :first_name, autofocus: true, required: true, placeholder: "First Name" %>
      <%= f.text_field :last_name, placeholder: "Last Name" %>
    </div>

    <div class="grid gap-x-4 md:grid-cols-2">
      <%= f.choices :country_multiple, ["United States", "Canada", "Mexico"], { label: "Multiple Select",include_blank: "Please Select…" }, { multiple: true, data: { max_item_count: 2 } } %>
      <%= f.choices :country, ["United States", "Canada", "Mexico", ["Other", data: { custom_properties: f.field_id(:country, "other", :fieldset) } ]], { hint: "Select Other to enable the custom country name field", include_blank: "Please Select…" }, { required: true, data: { action: "change->fields#enable", search: root_path, hint: "Select Other to enable the custom country name field." } } %>
    </div>

    <%= field_set_tag nil, disabled: true, class: "disabled:hidden", id: f.field_id(:country, :other, :fieldset), name: f.field_name(:country) do %>
      <%= f.text_field :country_name, placeholder: "What is your country?" %>
    <% end %>

    <%= f.email_field :email, autocomplete: "email", placeholder: "Email" %>
    <%= f.easepick :date, placeholder: "Select a date", data: {
      easepick_plugins: ["LockPlugin", "AmpPlugin"],
      easepick_amp_dropdown: {
        months: true,
        years: true,
        maxYear: Time.zone.today.year + 10,
        minYear: Time.zone.today.year - 10
      }
    } %>
    <%= f.password_field :password, autocomplete: "current-password", placeholder: "Password" %>
    <%= f.text_area :bio, placeholder: "Bio" %>
    <%= f.check_box :free_shipping, hint: "Hint text" %>

    <%= f.group class: "form__radio_collection" do %>
      <%= f.radio_button :radio, "1", label: "Radio 1" %>
      <%= f.radio_button :radio, "2", checked: true , hint: "Selected by default" %>
      <%= f.radio_button :radio, "3" %>
    <% end %>

    <%= f.toggler :toggler %>
  </div>

  <div class="form__actions">
    <%= f.submit "Save", class: "btn-lg" %>
  </div>
<% end %>