Class: Protos::Accordion

Inherits:
Component
  • Object
show all
Defined in:
lib/protos/accordion.rb,
lib/protos/accordion/item.rb

Defined Under Namespace

Classes: Item

Instance Method Summary collapse

Methods inherited from Component

#initialize

Constructor Details

This class inherits a constructor from Protos::Component

Instance Method Details

#contentObject



20
# File 'lib/protos/accordion.rb', line 20

def content(...) = render Collapse::Content.new(...)

#item(input_id: nil) ⇒ Object



14
15
16
17
18
# File 'lib/protos/accordion.rb', line 14

def item(*, input_id: nil, **, &)
  self.current_input_id = input_id

  render Item.new(*, input_id: current_input_id, **, &)
end

#titleObject



22
23
24
# File 'lib/protos/accordion.rb', line 22

def title(*, **, &)
  render Collapse::Title.new(*, input_id: current_input_id, **, &)
end

#view_templateObject

DOCS: The accordion component. Accordion is a collapse with radio buttons. Only one item can be open at a time. If you want to allow multiple items to be open at the same time, use the collapse component. daisyui.com/components/accordion/



10
11
12
# File 'lib/protos/accordion.rb', line 10

def view_template(&)
  ul(**attrs, &)
end