Module: GovukDesignSystem::WarningTextHelper
- Defined in:
- app/helpers/govuk_design_system/warning_text_helper.rb
Instance Method Summary collapse
-
#govukWarningText(iconFallbackText:, text: nil, html: nil, classes: "", attributes: {}) ⇒ Object
Use the [warning text component](design-system.service.gov.uk/components/warning-text/) when you need to warn users about something important, such as legal consequences of an action, or lack of action, that they might take.
Instance Method Details
#govukWarningText(iconFallbackText:, text: nil, html: nil, classes: "", attributes: {}) ⇒ Object
Use the [warning text component](design-system.service.gov.uk/components/warning-text/) when you need to warn users about something important, such as legal consequences of an action, or lack of action, that they might take.
Implementation based on github.com/alphagov/govuk-frontend/tree/master/src/govuk/components/warning-text
8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/helpers/govuk_design_system/warning_text_helper.rb', line 8 def govukWarningText(iconFallbackText:, text: nil, html: nil, classes: "", attributes: {}) attributes[:class] = "govuk-warning-text #{classes}" content_tag("div", attributes) do content_tag("span", "!", class: "govuk-warning-text__icon", "aria-hidden" => "true") + content_tag("strong", class: "govuk-warning-text__text") do content_tag("span", iconFallbackText, class: "govuk-warning-text__assistive") + (html || text) end end end |