Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Support wrapper for prepended and appended input #525

mckramer opened this Issue Mar 29, 2012 · 2 comments


None yet
3 participants

With Bootstrap 2.0.2, you can now have input with prepended and appended text. (See here.)

I am not sure how you would want to handle this, but possibly adding another wrapper, such as:

config.wrappers :prepend_and_append, :tag => 'div', :class => "control-group", :error_class => 'error' do |b|
    b.use :html5
    b.use :placeholder
    b.use :label
    b.wrapper :tag => 'div', :class => 'controls' do |input|
      input.wrapper :tag => 'div', :class => 'input-prepend input-append' do |append|
        append.use :input
      input.use :hint,  :wrap_with => { :tag => 'span', :class => 'help-block' }
      input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }

Which would properly display the following code:

= f.input :cost, wrapper => :prepend_and_append do
      = content_tag :span, "$", class: "add-on"
      = f.number_field :cost
      = content_tag :span, ".00", class: "add-on"

The only difference is both the input-prepend and input-append classes would be needed. Bootstrap uses the :first-child and :last-child selectors.

mlapeter commented Apr 4, 2012

Would love to see support for prepended and appended text added also. Thanks for the great work so far!


rafaelfranca commented Mar 20, 2014

See #531

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment