Module: CCS::FrontendHelpers::GovUKFrontend::Tag

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

Overview

GOV.UK Tag

This helper is used for generating the tag component from the GDS - Components - Tag

Instance Method Summary collapse

Instance Method Details

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

Generates the HTML for the GOV.UK Back link component

Parameters:

  • text (String)

    the text for the tag

  • colour (String) (defaults to: nil)

    optional colour for the tag, see Tag - Additional colours for available colours in GOV.UK Frontend

  • options (Hash)

    options that will be used in customising the HTML

Options Hash (**options):

  • :classes (String)

    additional CSS classes for the tag HTML

  • :attributes (Hash) — default: {}

    any additional attributes that will added as part of the HTML

Returns:

  • (ActiveSupport::SafeBuffer)


22
23
24
# File 'lib/ccs/frontend_helpers/govuk_frontend/tag.rb', line 22

def govuk_tag(text, colour = nil, **options)
  Components::GovUK::Tag.new(context: self, text: text, colour: colour, **options).render
end