Class: UI::AccordionTriggerComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- UI::AccordionTriggerComponent
- Includes:
- AccordionTriggerBehavior
- Defined in:
- app/view_components/ui/accordion_trigger_component.rb
Overview
Accordion Trigger component (ViewComponent) Button that toggles accordion item open/closed
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(item_value: nil, initial_open: false, classes: "", attributes: {}) ⇒ AccordionTriggerComponent
constructor
A new instance of AccordionTriggerComponent.
Methods included from AccordionTriggerBehavior
#aria_expanded, #caret_svg, #content_id, #item_value, #merged_trigger_data_attributes, #trigger_base_classes, #trigger_classes, #trigger_data_attributes, #trigger_html_attributes, #trigger_id, #trigger_state
Constructor Details
#initialize(item_value: nil, initial_open: false, classes: "", attributes: {}) ⇒ AccordionTriggerComponent
Returns a new instance of AccordionTriggerComponent.
17 18 19 20 21 22 |
# File 'app/view_components/ui/accordion_trigger_component.rb', line 17 def initialize(item_value: nil, initial_open: false, classes: "", attributes: {}) @item_value = item_value @initial_open = initial_open @classes = classes @attributes = attributes end |
Instance Method Details
#call ⇒ Object
24 25 26 27 28 29 30 |
# File 'app/view_components/ui/accordion_trigger_component.rb', line 24 def call content_tag :h3, class: "flex", "data-orientation": @orientation || "vertical", "data-state": trigger_state do content_tag :button, **trigger_html_attributes do safe_join([content, caret_svg]) end end end |