Class: DsfrComponent::AccordionComponent::SectionComponent
- Inherits:
-
Base
- Object
- ViewComponent::Base
- Base
- DsfrComponent::AccordionComponent::SectionComponent
- Includes:
- Traits::HeaderSizeable
- Defined in:
- app/components/dsfr_component/accordion_component/section_component.rb
Constant Summary
Constants included from Traits::HeaderSizeable
Traits::HeaderSizeable::DEFAULT_HEADER_LEVEL
Constants inherited from Base
Base::HEADING_LEVELS, Base::SIZES
Instance Attribute Summary collapse
-
#expanded ⇒ Object
(also: #expanded?)
readonly
Returns the value of attribute expanded.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Attributes inherited from Base
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(title:, header_level:, expanded: false, id: nil, html_attributes: {}) ⇒ SectionComponent
constructor
A new instance of SectionComponent.
Methods included from Traits::HeaderSizeable
#default_header_level, #header_level, #header_level=, #header_tag
Constructor Details
#initialize(title:, header_level:, expanded: false, id: nil, html_attributes: {}) ⇒ SectionComponent
Returns a new instance of SectionComponent.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/components/dsfr_component/accordion_component/section_component.rb', line 11 def initialize( title:, header_level:, expanded: false, id: nil, html_attributes: {} ) @title = title = @id = id self.header_level = header_level super(html_attributes: html_attributes) end |
Instance Attribute Details
#expanded ⇒ Object (readonly) Also known as: expanded?
Returns the value of attribute expanded.
4 5 6 |
# File 'app/components/dsfr_component/accordion_component/section_component.rb', line 4 def end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'app/components/dsfr_component/accordion_component/section_component.rb', line 4 def title @title end |
Instance Method Details
#id ⇒ Object
26 27 28 |
# File 'app/components/dsfr_component/accordion_component/section_component.rb', line 26 def id @id ||= "accordion-section-#{SecureRandom.hex(4)}" end |