Class: Flowbite::Input::Select
- Defined in:
- app/components/flowbite/input/select.rb
Overview
The ‘Select` component renders a select input field for use in forms.
flowbite.com/docs/forms/select/
Wraps ‘ActionView::Helpers::FormOptionsHelper#select`: api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-select
Constant Summary collapse
- SIZES =
{ sm: ["px-2.5", "py-2", "text-sm"], default: ["px-3", "py-2.5", "text-sm"], lg: ["px-3.5", "py-3", "text-base"] }.freeze
Constants inherited from Field
Instance Attribute Summary
Attributes inherited from Field
Instance Method Summary collapse
-
#call ⇒ Object
Returns the HTML to use for the actual input field element.
-
#initialize(form:, attribute:, class: nil, collection: [], disabled: false, include_blank: false, multiple: false, options: {}, size: :default) ⇒ Select
constructor
A new instance of Select.
-
#input_field_type ⇒ Object
Returns the name of the method used to generate HTML for the input field.
Methods inherited from Field
classes, #classes, sizes, styles
Constructor Details
#initialize(form:, attribute:, class: nil, collection: [], disabled: false, include_blank: false, multiple: false, options: {}, size: :default) ⇒ Select
Returns a new instance of Select.
17 18 19 20 21 22 |
# File 'app/components/flowbite/input/select.rb', line 17 def initialize(form:, attribute:, class: nil, collection: [], disabled: false, include_blank: false, multiple: false, options: {}, size: :default) super(form: form, attribute: attribute, class: binding.local_variable_get(:class), disabled: disabled, options: , size: size) @collection = collection @include_blank = include_blank @multiple = multiple end |
Instance Method Details
#call ⇒ Object
Returns the HTML to use for the actual input field element.
25 26 27 28 29 30 31 32 33 |
# File 'app/components/flowbite/input/select.rb', line 25 def call @form.send( input_field_type, @attribute, @collection, , ) end |
#input_field_type ⇒ Object
Returns the name of the method used to generate HTML for the input field
36 37 38 |
# File 'app/components/flowbite/input/select.rb', line 36 def input_field_type :select end |