Module: CCS::FrontendHelpers::GovUKFrontend::Panel

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

Overview

GOV.UK Panel

This helper is used for generating the panel component from the GDS - Components - Panel

Instance Method Summary collapse

Instance Method Details

#govuk_panel(title_text, panel_text = nil, **options) { ... } ⇒ ActiveSupport::SafeBuffer

Generates the HTML for the GOV.UK Panel component

Parameters:

  • title_text (String)

    title text for the panel which will be contained in haeding tags

  • panel_text (String) (defaults to: nil)

    text to use within the panel component. If nil, then a block will be rendered

  • options (Hash)

    options that will be used in customising the HTML

Options Hash (**options):

  • :classes (String)

    additional CSS classes for the panel HTML

  • :heading_level (Integer, String) — default: default: 1

    heading level for the panel title text

  • :attributes (Hash) — default: {}

    any additional attributes that will added as part of the HTML

Yields:

  • HTML that will be contained within the panel body. Ignored if panel text is given

Returns:

  • (ActiveSupport::SafeBuffer)


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

def govuk_panel(title_text, panel_text = nil, **options, &)
  Components::GovUK::Panel.new(context: self, title_text: title_text, panel_text: panel_text, **options).render(&)
end