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