Class: GovukComponent::SummaryListComponent::CardComponent

Inherits:
Base
  • Object
show all
Defined in:
app/components/govuk_component/summary_list_component/card_component.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#html_attributes

Instance Method Summary collapse

Methods inherited from Base

#brand, #class_prefix

Constructor Details

#initialize(title:, heading_level: 2, actions: [], classes: [], html_attributes: {}) ⇒ CardComponent

Returns a new instance of CardComponent.



7
8
9
10
11
12
13
# File 'app/components/govuk_component/summary_list_component/card_component.rb', line 7

def initialize(title:, heading_level: 2, actions: [], classes: [], html_attributes: {})
  @title = title
  @heading_level = heading_tag(heading_level)
  actions.each { |a| with_action { a } } if actions.any?

  super(classes:, html_attributes:)
end

Instance Attribute Details

#heading_levelObject (readonly)

Returns the value of attribute heading_level.



2
3
4
# File 'app/components/govuk_component/summary_list_component/card_component.rb', line 2

def heading_level
  @heading_level
end

#titleObject (readonly)

Returns the value of attribute title.



2
3
4
# File 'app/components/govuk_component/summary_list_component/card_component.rb', line 2

def title
  @title
end