<% # headmin/forms/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 'headmin/forms/select', form: form, attribute: :color, collection: %w[red green blue] %#> # <% end %#> select = Headmin::Form::SelectView.new(local_assigns) %> <%= render 'headmin/forms/wrapper', select.wrapper_options do %> <%= render 'headmin/forms/label', select.label_options if select.prepend_label? %> <%= render 'headmin/forms/input_group', select.input_group_options do %> <%= form.select(select.attribute, select.collection, select.select_options, select.input_options) %> <% end %> <%= render 'headmin/forms/validation', select.validation_options if select.validate? %> <%= render 'headmin/forms/hint', select.hint_options if select.hint? %> <%= render 'headmin/forms/datalist', select.datalist_options if select.datalist? %> <%= render 'headmin/forms/label', select.label_options if select.append_label? %> <% end %>