Class: UI::SelectItemComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- UI::SelectItemComponent
- Includes:
- SelectItemBehavior
- Defined in:
- app/view_components/ui/select_item_component.rb
Overview
ItemComponent - ViewComponent implementation
Individual selectable option in the dropdown.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(value: nil, disabled: false, classes: "", **attributes) ⇒ SelectItemComponent
constructor
A new instance of SelectItemComponent.
Methods included from SelectItemBehavior
#select_item_classes, #select_item_html_attributes
Constructor Details
#initialize(value: nil, disabled: false, classes: "", **attributes) ⇒ SelectItemComponent
Returns a new instance of SelectItemComponent.
19 20 21 22 23 24 |
# File 'app/view_components/ui/select_item_component.rb', line 19 def initialize(value: nil, disabled: false, classes: "", **attributes) @value = value @disabled = disabled @classes = classes @attributes = attributes end |
Instance Method Details
#call ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/view_components/ui/select_item_component.rb', line 26 def call content_tag :div, **select_item_html_attributes.deep_merge(@attributes) do safe_join([ content_tag(:span, content, class: "flex-1"), content_tag(:svg, content_tag(:path, nil, d: "M20 6 9 17l-5-5"), data: {ui__select_target: "itemCheck"}, class: "ml-auto size-4 opacity-0 transition-opacity", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", stroke_width: "2", stroke_linecap: "round", stroke_linejoin: "round") ]) end end |