Class: CCS::Components::GovUK::SummaryList::Row::Key

Inherits:
Base
  • Object
show all
Defined in:
lib/ccs/components/govuk/summary_list/row/key.rb

Overview

GOV.UK Summary list row key

Constant Summary collapse

DEFAULT_ATTRIBUTES =

The default attributes for the summary list row key

{ class: 'govuk-summary-list__key' }.freeze

Instance Method Summary collapse

Constructor Details

#initialize(text:, **options) ⇒ Key

Returns a new instance of Key.

Parameters:

  • text (String)

    Text for the summary list row key

  • options (Hash)

    options that will be used in customising the HTML

Options Hash (**options):

  • :classes (String)

    additional CSS classes for the summary list row key HTML



25
26
27
28
29
# File 'lib/ccs/components/govuk/summary_list/row/key.rb', line 25

def initialize(text:, **options)
  super(**options)

  @text = text
end

Instance Method Details

#renderActiveSupport::SafeBuffer

Generates the HTML for the GOV.UK Summary list row key

Returns:

  • (ActiveSupport::SafeBuffer)


35
36
37
# File 'lib/ccs/components/govuk/summary_list/row/key.rb', line 35

def render
  tag.dt(text, class: @options[:attributes][:class])
end