Class: FoxTail::InputBaseComponent

Inherits:
BaseComponent show all
Includes:
Concerns::Formable, Concerns::HasStimulusController, Concerns::Placeholderable
Defined in:
app/components/fox_tail/input_base_component.rb

Defined Under Namespace

Classes: StimulusController

Instance Attribute Summary

Attributes inherited from BaseComponent

#html_attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseComponent

classname_merger, #initialize, stimulus_merger, use_stimulus?, #with_html_attributes, #with_html_class

Methods inherited from Base

fox_tail_config

Constructor Details

This class inherits a constructor from FoxTail::BaseComponent

Class Method Details

.stimulus_controller_nameObject



49
50
51
# File 'app/components/fox_tail/input_base_component.rb', line 49

def stimulus_controller_name
  "form-field"
end

Instance Method Details

#before_renderObject



12
13
14
15
16
17
18
# File 'app/components/fox_tail/input_base_component.rb', line 12

def before_render
  super

  add_default_name_and_id
  update_state_from_object!
  html_attributes[:placeholder] = retrieve_placeholder if placeholder?
end

#stimulus_controller_optionsObject



24
25
26
# File 'app/components/fox_tail/input_base_component.rb', line 24

def stimulus_controller_options
  {}
end

#use_stimulus?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'app/components/fox_tail/input_base_component.rb', line 20

def use_stimulus?
  super && controlled?
end