Module: CCS::FrontendHelpers::GovUKFrontend::Accordion

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

Overview

GOV.UK Accordion

This helper is used for generating the accordion component from the GDS - Components - Accordion

Instance Method Summary collapse

Instance Method Details

#govuk_accordion(accordion_id, accordion_sections) ⇒ ActiveSupport::SafeBuffer

Generates the HTML for the GOV.UK Accordion component

Parameters:

  • accordion_id (String)

    used as an id in the HTML for the accordion as a whole, and also as a prefix for the ids of the section contents and the buttons that open them

  • accordion_sections (Array<Hash>)

    an array of accordion section attributes. See Section#initialize for details of the items in the array.

  • options (Hash)

    options that will be used in customising the HTML

Returns:

  • (ActiveSupport::SafeBuffer)


22
23
24
# File 'lib/ccs/frontend_helpers/govuk_frontend/accordion.rb', line 22

def govuk_accordion(accordion_id, accordion_sections, **)
  Components::GovUK::Accordion.new(context: self, accordion_id: accordion_id, accordion_sections: accordion_sections, **).render
end