Class: Maglev::Uikit::Form::TextFieldComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Maglev::Uikit::Form::TextFieldComponent
- Defined in:
- app/components/maglev/uikit/form/text_field_component.rb
Instance Attribute Summary collapse
-
#html_options ⇒ Object
readonly
Returns the value of attribute html_options.
-
#input_action ⇒ Object
readonly
Returns the value of attribute input_action.
-
#input_data ⇒ Object
readonly
Returns the value of attribute input_data.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #dom_id ⇒ Object
- #error ⇒ Object
- #hint ⇒ Object
-
#initialize(label:, name:, options: {}, html_options: {}) ⇒ TextFieldComponent
constructor
options: { value: nil, placeholder: nil, error: nil } html_options: { data: { attribute: ‘value’ } }.
- #placeholder ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(label:, name:, options: {}, html_options: {}) ⇒ TextFieldComponent
options: { value: nil, placeholder: nil, error: nil } html_options: { data: { attribute: ‘value’ } }
11 12 13 14 15 16 17 18 |
# File 'app/components/maglev/uikit/form/text_field_component.rb', line 11 def initialize(label:, name:, options: {}, html_options: {}) @label = label @name = name @options = @html_options = @input_data = .delete(:data) || {} @input_action = input_data.delete(:action) || {} end |
Instance Attribute Details
#html_options ⇒ Object (readonly)
Returns the value of attribute html_options.
7 8 9 |
# File 'app/components/maglev/uikit/form/text_field_component.rb', line 7 def @html_options end |
#input_action ⇒ Object (readonly)
Returns the value of attribute input_action.
7 8 9 |
# File 'app/components/maglev/uikit/form/text_field_component.rb', line 7 def input_action @input_action end |
#input_data ⇒ Object (readonly)
Returns the value of attribute input_data.
7 8 9 |
# File 'app/components/maglev/uikit/form/text_field_component.rb', line 7 def input_data @input_data end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
7 8 9 |
# File 'app/components/maglev/uikit/form/text_field_component.rb', line 7 def label @label end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'app/components/maglev/uikit/form/text_field_component.rb', line 7 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'app/components/maglev/uikit/form/text_field_component.rb', line 7 def @options end |
Instance Method Details
#dom_id ⇒ Object
20 21 22 |
# File 'app/components/maglev/uikit/form/text_field_component.rb', line 20 def dom_id name.to_s.parameterize.underscore end |
#error ⇒ Object
36 37 38 |
# File 'app/components/maglev/uikit/form/text_field_component.rb', line 36 def error [:error] end |
#hint ⇒ Object
28 29 30 |
# File 'app/components/maglev/uikit/form/text_field_component.rb', line 28 def hint [:hint] end |
#placeholder ⇒ Object
32 33 34 |
# File 'app/components/maglev/uikit/form/text_field_component.rb', line 32 def placeholder [:placeholder] end |
#value ⇒ Object
24 25 26 |
# File 'app/components/maglev/uikit/form/text_field_component.rb', line 24 def value [:value] end |