Class: Maglev::Uikit::Form::TextareaComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Maglev::Uikit::Form::TextareaComponent
- Defined in:
- app/components/maglev/uikit/form/textarea_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
-
#initialize(label:, name:, options: {}, html_options: {}) ⇒ TextareaComponent
constructor
options: { value: nil, rows: 2, max_length: nil }.
- #max_length ⇒ Object
- #max_length? ⇒ Boolean
- #num_characters ⇒ Object
- #placeholder ⇒ Object
- #rows ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(label:, name:, options: {}, html_options: {}) ⇒ TextareaComponent
options: { value: nil, rows: 2, max_length: nil }
10 11 12 13 14 15 16 17 |
# File 'app/components/maglev/uikit/form/textarea_component.rb', line 10 def initialize(label:, name:, options: {}, html_options: {}) @label = label @name = name @options = @input_data = .delete(:data) || {} @input_action = input_data.delete(:action) || {} @html_options = end |
Instance Attribute Details
#html_options ⇒ Object (readonly)
Returns the value of attribute html_options.
7 8 9 |
# File 'app/components/maglev/uikit/form/textarea_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/textarea_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/textarea_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/textarea_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/textarea_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/textarea_component.rb', line 7 def @options end |
Instance Method Details
#dom_id ⇒ Object
19 20 21 |
# File 'app/components/maglev/uikit/form/textarea_component.rb', line 19 def dom_id name.to_s.parameterize.underscore end |
#error ⇒ Object
47 48 49 |
# File 'app/components/maglev/uikit/form/textarea_component.rb', line 47 def error [:error] end |
#max_length ⇒ Object
35 36 37 |
# File 'app/components/maglev/uikit/form/textarea_component.rb', line 35 def max_length [:max_length] end |
#max_length? ⇒ Boolean
43 44 45 |
# File 'app/components/maglev/uikit/form/textarea_component.rb', line 43 def max_length? max_length.present? end |
#num_characters ⇒ Object
39 40 41 |
# File 'app/components/maglev/uikit/form/textarea_component.rb', line 39 def num_characters value.to_s.length end |
#placeholder ⇒ Object
23 24 25 |
# File 'app/components/maglev/uikit/form/textarea_component.rb', line 23 def placeholder [:placeholder] end |
#rows ⇒ Object
31 32 33 |
# File 'app/components/maglev/uikit/form/textarea_component.rb', line 31 def rows [:rows] end |
#value ⇒ Object
27 28 29 |
# File 'app/components/maglev/uikit/form/textarea_component.rb', line 27 def value [:value] end |