Module: CCS::FrontendHelpers::GovUKFrontend::Hint

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

Overview

GOV.UK Hint

This helper is used for generating the hint text component from the Government Design Systems

Instance Method Summary collapse

Instance Method Details

#govuk_hint(text = nil, **options) ⇒ ActiveSupport::SafeBuffer

Generates the HTML for the GOV.UK Hint component

Parameters:

  • text (String) (defaults to: nil)

    the hint text. 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 hint HTML

  • :attributes (Hash) — default: {}

    any additional attributes that will added as part of the HTML

Returns:

  • (ActiveSupport::SafeBuffer)


23
24
25
# File 'lib/ccs/frontend_helpers/govuk_frontend/hint.rb', line 23

def govuk_hint(text = nil, **options, &)
  Components::GovUK::Hint.new(context: self, text: text, **options).render(&)
end