Module: CCS::FrontendHelpers::GovUKFrontend::WarningText

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

Overview

GOV.UK Warning text

This helper is used for generating the warning text component from the GDS - Components - Warning text

Instance Method Summary collapse

Instance Method Details

#govuk_warning_text(text = nil) { ... } ⇒ ActiveSupport::SafeBuffer

Generates the HTML for the GOV.UK Warning text component

Parameters:

  • text (String) (defaults to: nil)

    (nil) the text for the warning If nil, then a block will be rendered

  • options (Hash)

    options that will be used in customising the HTML

Yields:

  • HTML that will be used in the warning text. Ignored if text is passed.

Returns:

  • (ActiveSupport::SafeBuffer)


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

def govuk_warning_text(text = nil, **, &)
  Components::GovUK::WarningText.new(context: self, text: text, **).render(&)
end