Class: UI::AccordionItem
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::AccordionItem
- Includes:
- AccordionItemBehavior
- Defined in:
- app/components/ui/accordion_item.rb
Overview
Accordion Item component (Phlex) Individual collapsible item within an accordion
Instance Attribute Summary collapse
-
#initial_open ⇒ Object
readonly
Returns the value of attribute initial_open.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #initial_open_context ⇒ Object
-
#initialize(value: "", initial_open: false, classes: "", attributes: {}) ⇒ AccordionItem
constructor
A new instance of AccordionItem.
-
#item_value_context ⇒ Object
Helper methods that child components can call to get parent context.
- #view_template(&block) ⇒ Object
Methods included from AccordionItemBehavior
#item_base_classes, #item_classes, #item_data_attributes, #item_html_attributes, #item_state, #merged_item_data_attributes
Constructor Details
#initialize(value: "", initial_open: false, classes: "", attributes: {}) ⇒ AccordionItem
Returns a new instance of AccordionItem.
25 26 27 28 29 30 |
# File 'app/components/ui/accordion_item.rb', line 25 def initialize(value: "", initial_open: false, classes: "", attributes: {}, **) @value = value @initial_open = initial_open @classes = classes @attributes = attributes end |
Instance Attribute Details
#initial_open ⇒ Object (readonly)
Returns the value of attribute initial_open.
19 20 21 |
# File 'app/components/ui/accordion_item.rb', line 19 def initial_open @initial_open end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
19 20 21 |
# File 'app/components/ui/accordion_item.rb', line 19 def value @value end |
Instance Method Details
#initial_open_context ⇒ Object
45 46 47 |
# File 'app/components/ui/accordion_item.rb', line 45 def initial_open_context @initial_open end |
#item_value_context ⇒ Object
Helper methods that child components can call to get parent context
41 42 43 |
# File 'app/components/ui/accordion_item.rb', line 41 def item_value_context @value end |
#view_template(&block) ⇒ Object
32 33 34 35 36 37 38 |
# File 'app/components/ui/accordion_item.rb', line 32 def view_template(&block) div(**item_html_attributes) do # Pass context to child components by rendering the block # Child components will receive item_value and initial_open through helpers instance_exec(&block) if block end end |