How to add an empty span to Simple Form wrapper

Viewed 271

I would like to build a custom wrapper for my input fields using SimpleForm that has an empty span element beneath the label.

I would like the HTML to end up like this:

<div class="custom-input">
  <input />
  <label />
  <span class="bar"/>
</div>

my initializers/simple_form.rb includes this:

config.wrappers :custom_input, tag: 'div', class: "custom-input" do |b|
    b.use :html5
    b.optional :placeholder
    b.optional :maxlength
    b.optional :minlength
    b.optional :pattern
    b.optional :min_max
    b.optional :readonly
    b.wrapper tag: 'span', class: 'bar' do |ba|
      ba.use :input
      ba.use :label
    end
    b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
end

This wraps the input and label in a span, but I would like the span to be below the label.

I have tried building a custom simple form component without any luck.

Any help would be greatly appreciated!

0 Answers
Related