Class: Arara::ChipComponent
- Inherits:
-
ActionView::Component::Base
- Object
- ActionView::Component::Base
- Arara::ChipComponent
- Includes:
- BaseComponent
- Defined in:
- app/components/arara/chip_component.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#selected ⇒ Object
readonly
Returns the value of attribute selected.
-
#user_variant ⇒ Object
readonly
Returns the value of attribute user_variant.
Instance Method Summary collapse
- #default_html_class ⇒ Object
-
#initialize(id:, label:, variant: "choice", selected: false, should_remove_on_trailing_icon_click: false, **kw) ⇒ ChipComponent
constructor
A new instance of ChipComponent.
Methods included from BaseComponent
#default_data_controller, #default_html_tag, #html_class, #html_content, #html_data, #html_options, #html_tag, included
Constructor Details
#initialize(id:, label:, variant: "choice", selected: false, should_remove_on_trailing_icon_click: false, **kw) ⇒ ChipComponent
Returns a new instance of ChipComponent.
7 8 9 10 11 12 13 |
# File 'app/components/arara/chip_component.rb', line 7 def initialize(id:, label:, variant: "choice", selected: false, should_remove_on_trailing_icon_click: false, **kw) @id = id @label = label @selected = selected @should_remove_on_trailing_icon_click = should_remove_on_trailing_icon_click super(tag: "div", variant: variant, **kw) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
15 16 17 |
# File 'app/components/arara/chip_component.rb', line 15 def id @id end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
15 16 17 |
# File 'app/components/arara/chip_component.rb', line 15 def label @label end |
#selected ⇒ Object (readonly)
Returns the value of attribute selected.
15 16 17 |
# File 'app/components/arara/chip_component.rb', line 15 def selected @selected end |
#user_variant ⇒ Object (readonly)
Returns the value of attribute user_variant.
15 16 17 |
# File 'app/components/arara/chip_component.rb', line 15 def user_variant @user_variant end |
Instance Method Details
#default_html_class ⇒ Object
17 18 19 20 |
# File 'app/components/arara/chip_component.rb', line 17 def default_html_class return "mdc-chip mdc-chip--selected" if selected "mdc-chip" end |