Class: Anchor::SelectComponent
- Defined in:
- app/components/anchor/select_component.rb
Constant Summary
Constants included from ViewHelper
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
Instance Method Summary collapse
- #html_options ⇒ Object
- #icon_classes ⇒ Object
-
#initialize(form_builder:, attribute:, choices:, show_marker: true, **kwargs) ⇒ SelectComponent
constructor
A new instance of SelectComponent.
- #show_marker? ⇒ Boolean
Methods inherited from Component
Methods included from ViewHelper
#anchor_form_with, #anchor_svg, #deep_blank?, #merge_options, #popover_trigger_attributes
Methods included from FetchOrFallbackHelper
Constructor Details
#initialize(form_builder:, attribute:, choices:, show_marker: true, **kwargs) ⇒ SelectComponent
Returns a new instance of SelectComponent.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/components/anchor/select_component.rb', line 5 def initialize( form_builder:, attribute:, choices:, show_marker: true, **kwargs ) @form_builder = form_builder @attribute = attribute @choices = choices @show_marker = show_marker super(**kwargs) end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
3 4 5 |
# File 'app/components/anchor/select_component.rb', line 3 def attribute @attribute end |
Instance Method Details
#html_options ⇒ Object
24 25 26 27 28 29 |
# File 'app/components/anchor/select_component.rb', line 24 def { class: InputComponent::INPUT_CLASSES, data: { testid: "select-#{attribute.to_s.dasherize}" }, } end |
#icon_classes ⇒ Object
20 21 22 |
# File 'app/components/anchor/select_component.rb', line 20 def icon_classes class_names(InputComponent::ICON_CLASSES, "right-4") end |
#show_marker? ⇒ Boolean
31 32 33 |
# File 'app/components/anchor/select_component.rb', line 31 def show_marker? @show_marker end |