Class: DaisyUI::Accordion
- Defined in:
- lib/daisy_ui/accordion.rb
Constant Summary
Constants inherited from Base
Base::BOOLS, Base::COLOR_MODIFIERS
Instance Method Summary collapse
-
#initialize(name:, checked: false, as: :div) ⇒ Accordion
constructor
A new instance of Accordion.
- #title(**options, &block) ⇒ Object
- #view_template(&block) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(name:, checked: false, as: :div) ⇒ Accordion
Returns a new instance of Accordion.
8 9 10 11 12 |
# File 'lib/daisy_ui/accordion.rb', line 8 def initialize(*, name:, checked: false, as: :div, **) super(*, as:, **) @name = name @checked = checked end |
Instance Method Details
#title(**options, &block) ⇒ Object
22 23 24 25 |
# File 'lib/daisy_ui/accordion.rb', line 22 def title(**, &block) @title_options = @title_block = block end |
#view_template(&block) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/daisy_ui/accordion.rb', line 14 def view_template(&block) public_send(as, class: classes, **attributes) do input(type: :radio, name:, checked:) div(class: component_classes("collapse-title", options: || {}), &title_block) if title_block div(class: component_classes("collapse-content", options: {}), &block) if block end end |