Class: GOVUKDesignSystemFormBuilder::Elements::Caption
- Includes:
- Traits::Localisation
- Defined in:
- lib/govuk_design_system_formbuilder/elements/caption.rb
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize(builder, object_name, attribute_name, text: nil, size: config.default_caption_size, **kwargs) ⇒ Caption
constructor
A new instance of Caption.
Methods inherited from Base
Constructor Details
#initialize(builder, object_name, attribute_name, text: nil, size: config.default_caption_size, **kwargs) ⇒ Caption
Returns a new instance of Caption.
6 7 8 9 10 11 12 |
# File 'lib/govuk_design_system_formbuilder/elements/caption.rb', line 6 def initialize(builder, object_name, attribute_name, text: nil, size: config.default_caption_size, **kwargs) super(builder, object_name, attribute_name) @text = text(text) @size_class = size_class(size) @html_attributes = kwargs end |
Instance Method Details
#html ⇒ Object
14 15 16 17 18 |
# File 'lib/govuk_design_system_formbuilder/elements/caption.rb', line 14 def html return unless active? tag.span(@text, class: @size_class, **@html_attributes) end |