<% # formstrap/select # # ==== Required parameters # * +attribute+ - Name of the attribute of the form model # * +form+ - Form object # * +collection+ - Values to create option tags for # # ==== Optional parameters # * +append+ - Display as input group with text on the right-hand side # * +float+ - Use floating labels. Defaults to false # * +hint+ - Informative text to assist with data input. HTML markup is allowed. # * +label+ - Text to display inside label tag. Defaults to the attribute name. Set to false if you don"t want to show a label. # * +list+ - Options are passed through options_for_select # * +plaintext+ - Render input as plain text. # * +prepend+ - Display as input group with text on the left-hand side # * +tags+ - Allow options to be created dynamically. This will set the multiple attribute to true # * +wrapper+ - Hash with all options for the surrounding html tag # # ==== References # https://headmin.dev/docs/forms/select # https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select # https://apidock.com/rails/ActionView/Helpers/FormOptionsHelper/select # # ==== Examples # Basic version # <%= form_with do |form| %#> # <%= render "formstrap/select", form: form, attribute: :color, collection: %w[red green blue] %#> # <% end %#> select = Formstrap::SelectView.new(local_assigns) %> <%= render "formstrap/wrapper", select.wrapper_options do %> <%= render "formstrap/label", select.label_options if select.prepend_label? %> <%= render "formstrap/input_group", select.input_group_options do %> <%= form.select(select.attribute, formstrap: false, choices: select.collection, options: select.select_options, html_options: select.input_options) %> <% end %> <%= render "formstrap/validation", select.validation_options if select.validate? %> <%= render "formstrap/hint", select.hint_options if select.hint? %> <%= render "formstrap/datalist", select.datalist_options if select.datalist? %> <%= render "formstrap/label", select.label_options if select.append_label? %> <% end %>