Class: CCS::Components::GovUK::Hint
- Defined in:
- lib/ccs/components/govuk/hint.rb
Overview
GOV.UK Hint
This is used to generate the hint text component from the Government Design Systems
Constant Summary collapse
- DEFAULT_ATTRIBUTES =
The default attributes for the hint
{ class: 'govuk-hint' }.freeze
Instance Method Summary collapse
-
#initialize(text: nil, **options) ⇒ Hint
constructor
A new instance of Hint.
-
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Hint component.
Constructor Details
#initialize(text: nil, **options) ⇒ Hint
Returns a new instance of Hint.
27 28 29 30 31 |
# File 'lib/ccs/components/govuk/hint.rb', line 27 def initialize(text: nil, **) super(**) @text = text end |
Instance Method Details
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Hint component
37 38 39 40 41 |
# File 'lib/ccs/components/govuk/hint.rb', line 37 def render tag.div(**[:attributes]) do text || yield end end |