Class: SdrViewComponents::Forms::SelectFieldComponent

Inherits:
FieldComponent show all
Defined in:
app/components/sdr_view_components/forms/select_field_component.rb

Overview

Component for form select fields

Instance Attribute Summary collapse

Attributes inherited from FieldComponent

#args, #field_name, #form, #variant

Instance Method Summary collapse

Methods inherited from FieldComponent

#container_args, #container_classes, #error_args, #help_text_args, #help_text_below?, #input_args, #label_args, #label_field_name

Methods inherited from BaseComponent

#args_for, #merge_actions, #merge_classes

Constructor Details

#initialize(options:, prompt: false) ⇒ SelectFieldComponent

Returns a new instance of SelectFieldComponent.



7
8
9
10
11
# File 'app/components/sdr_view_components/forms/select_field_component.rb', line 7

def initialize(options:, prompt: false, **)
  @options = options
  @prompt = prompt
  super(**)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



13
14
15
# File 'app/components/sdr_view_components/forms/select_field_component.rb', line 13

def options
  @options
end

#promptObject (readonly)

Returns the value of attribute prompt.



13
14
15
# File 'app/components/sdr_view_components/forms/select_field_component.rb', line 13

def prompt
  @prompt
end

Instance Method Details

#input_componentObject



15
16
17
# File 'app/components/sdr_view_components/forms/select_field_component.rb', line 15

def input_component
  SdrViewComponents::Forms::BasicSelectFieldComponent.new(form:, field_name:, options:, prompt:, **input_args)
end