Class: GovukComponent::TagComponent
- Defined in:
- app/components/govuk_component/tag_component.rb
Constant Summary collapse
- COLOURS =
%w(grey green turquoise blue light-blue red purple pink orange yellow).freeze
Instance Attribute Summary collapse
-
#colour ⇒ Object
readonly
Returns the value of attribute colour.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(text: nil, colour: config.default_tag_colour, classes: [], html_attributes: {}) ⇒ TagComponent
constructor
A new instance of TagComponent.
Methods inherited from Base
Constructor Details
#initialize(text: nil, colour: config.default_tag_colour, classes: [], html_attributes: {}) ⇒ TagComponent
Returns a new instance of TagComponent.
6 7 8 9 10 11 |
# File 'app/components/govuk_component/tag_component.rb', line 6 def initialize(text: nil, colour: config.default_tag_colour, classes: [], html_attributes: {}) @text = text @colour = colour super(classes:, html_attributes:) end |
Instance Attribute Details
#colour ⇒ Object (readonly)
Returns the value of attribute colour.
2 3 4 |
# File 'app/components/govuk_component/tag_component.rb', line 2 def colour @colour end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
2 3 4 |
# File 'app/components/govuk_component/tag_component.rb', line 2 def text @text end |
Instance Method Details
#call ⇒ Object
13 14 15 |
# File 'app/components/govuk_component/tag_component.rb', line 13 def call tag.strong(tag_content, **html_attributes) end |