Class: Arara::SelectComponent
- Inherits:
-
ActionView::Component::Base
- Object
- ActionView::Component::Base
- Arara::SelectComponent
- Includes:
- BaseComponent
- Defined in:
- app/components/arara/select_component.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#selected_label ⇒ Object
readonly
Returns the value of attribute selected_label.
-
#selected_value ⇒ Object
readonly
Returns the value of attribute selected_value.
Instance Method Summary collapse
- #default_data_controller ⇒ Object
- #default_html_class ⇒ Object
-
#initialize(variant: "default", id: nil, name: nil, label:, selected_value: nil, selected_label: nil, **kw) ⇒ SelectComponent
constructor
A new instance of SelectComponent.
Methods included from BaseComponent
#default_html_tag, #html_class, #html_content, #html_data, #html_options, #html_tag, included
Constructor Details
#initialize(variant: "default", id: nil, name: nil, label:, selected_value: nil, selected_label: nil, **kw) ⇒ SelectComponent
Returns a new instance of SelectComponent.
8 9 10 11 12 13 14 15 16 |
# File 'app/components/arara/select_component.rb', line 8 def initialize(variant: "default", id: nil, name: nil, label:, selected_value: nil, selected_label: nil, **kw) super(tag: "div", variant: variant, **kw) @id = id @name = name @label = label @selected_value = selected_value @selected_label = selected_label end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'app/components/arara/select_component.rb', line 4 def id @id end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
4 5 6 |
# File 'app/components/arara/select_component.rb', line 4 def label @label end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'app/components/arara/select_component.rb', line 4 def name @name end |
#selected_label ⇒ Object (readonly)
Returns the value of attribute selected_label.
4 5 6 |
# File 'app/components/arara/select_component.rb', line 4 def selected_label @selected_label end |
#selected_value ⇒ Object (readonly)
Returns the value of attribute selected_value.
4 5 6 |
# File 'app/components/arara/select_component.rb', line 4 def selected_value @selected_value end |
Instance Method Details
#default_data_controller ⇒ Object
18 19 20 |
# File 'app/components/arara/select_component.rb', line 18 def default_data_controller "mdc-select" end |
#default_html_class ⇒ Object
22 23 24 25 |
# File 'app/components/arara/select_component.rb', line 22 def default_html_class return "mdc-select mdc-select--outlined" if user_variant == "outlined" "mdc-select" end |