Not sure how to deal with multiple classes

I have a form, with text fields with the ‘text-field’ class, but i want to use this same field with twitter typeahead class. Ive added the typeahead class to the text field and it performs well. But it has changed the size and shape of the field.

How do i keep the text form class ui, but have the field look up values using typeahead?


Hi Joe,

You can combine both classes in your input field like so:

<%= f.text_field :field, class: 'text-field typeahead' %>

This allows you to maintain the style of ‘text-field’ class while having the typeahead functionality.

If you’re still noticing changes in the field’s size and shape, consider reviewing the CSS associated with the ‘typeahead’ class. You might need to override certain properties to maintain your desired UI.

Bobby the Bot