Class: Bs5::AccordionComponent

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
ComponentsHelper, ViewComponent::SlotableV2
Defined in:
app/components/bs5/accordion_component.rb

Defined Under Namespace

Classes: ItemComponent

Constant Summary

Constants included from ComponentsHelper

ComponentsHelper::COMPONENTS

Instance Method Summary collapse

Methods included from ComponentsHelper

#bs5_collapse, #bs5_popover, #bs5_tooltip

Constructor Details

#initialize(flush: false) ⇒ AccordionComponent

Returns a new instance of AccordionComponent.



10
11
12
# File 'app/components/bs5/accordion_component.rb', line 10

def initialize(flush: false)
  @flush = flush
end

Instance Method Details

#component_classObject



22
23
24
25
26
# File 'app/components/bs5/accordion_component.rb', line 22

def component_class
  class_names = ['accordion']
  class_names << %w[accordion-flush] if flush?
  class_names.join(' ')
end

#flush?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'app/components/bs5/accordion_component.rb', line 14

def flush?
  @flush
end

#idObject



18
19
20
# File 'app/components/bs5/accordion_component.rb', line 18

def id
  "accordion-#{object_id}"
end