Class: UI::SelectTriggerComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- UI::SelectTriggerComponent
- Includes:
- SelectTriggerBehavior
- Defined in:
- app/view_components/ui/select_trigger_component.rb
Overview
TriggerComponent - ViewComponent implementation
Button that opens the select dropdown. Note: ViewComponent version uses template for asChild support
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(placeholder: "Select...", classes: "", **attributes) ⇒ SelectTriggerComponent
constructor
A new instance of SelectTriggerComponent.
Methods included from SelectTriggerBehavior
#select_trigger_classes, #select_trigger_html_attributes
Constructor Details
#initialize(placeholder: "Select...", classes: "", **attributes) ⇒ SelectTriggerComponent
Returns a new instance of SelectTriggerComponent.
16 17 18 19 20 |
# File 'app/view_components/ui/select_trigger_component.rb', line 16 def initialize(placeholder: "Select...", classes: "", **attributes) @placeholder = placeholder @classes = classes @attributes = attributes end |
Instance Method Details
#call ⇒ Object
22 23 24 25 26 |
# File 'app/view_components/ui/select_trigger_component.rb', line 22 def call content_tag :button, **select_trigger_html_attributes.deep_merge(@attributes) do content_tag :span, @placeholder, data: {ui__select_target: "valueDisplay"} end end |