Module: CCS::FrontendHelpers::GovUKFrontend::Details

Included in:
CCS::FrontendHelpers::GovUKFrontend
Defined in:
lib/ccs/frontend_helpers/govuk_frontend/details.rb

Overview

GOV.UK Details

This helper is used for generating the details component from the GDS - Components - Details

Instance Method Summary collapse

Instance Method Details

#govuk_details(summary_text, **options) { ... } ⇒ ActiveSupport::SafeBuffer

Generates the HTML for the GOV.UK Details component

Parameters:

  • summary_text (String)

    the summary text for the details element

  • options (Hash)

    options that will be used in customising the HTML

Options Hash (**options):

  • :classes (String)

    additional CSS classes for the details HTML

  • :attributes (Hash) — default: { data: { module: 'govuk-details' } }

    any additional attributes that will added as part of the HTML

Yields:

  • HTML that will be contained within the ‘govuk-details__text’ div

Returns:

  • (ActiveSupport::SafeBuffer)

    the HTML for the GOV.UK Details which can then be rendered on the page



24
25
26
# File 'lib/ccs/frontend_helpers/govuk_frontend/details.rb', line 24

def govuk_details(summary_text, **options, &)
  Components::GovUK::Details.new(context: self, summary_text: summary_text, **options).render(&)
end