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: ["p-2", "text-xs"], default: ["p-2.5", "text-sm"], lg: ["px-4", "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:, collection: [], disabled: 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:, collection: [], disabled: false, options: {}, size: :default) ⇒ Select
Returns a new instance of Select.
17 18 19 20 |
# File 'app/components/flowbite/input/select.rb', line 17 def initialize(form:, attribute:, collection: [], disabled: false, options: {}, size: :default) super(form: form, attribute: attribute, disabled: disabled, options: , size: size) @collection = collection end |
Instance Method Details
#call ⇒ Object
Returns the HTML to use for the actual input field element.
23 24 25 26 27 28 29 30 31 |
# File 'app/components/flowbite/input/select.rb', line 23 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
34 35 36 |
# File 'app/components/flowbite/input/select.rb', line 34 def input_field_type :select end |