Sha256: 3cdc6676043d42d2b8c35b5a2c889bdb7193b2b18ac4ea9e8f5eb79d3989cd84

Contents?: true

Size: 1.85 KB

Versions: 15

Compression:

Stored size: 1.85 KB

Contents

{% from "../error-message/macro.njk" import govukErrorMessage -%}
{% from "../hint/macro.njk" import govukHint %}
{% from "../label/macro.njk" import govukLabel %}

{#- a record of other elements that we need to associate with the input using
   aria-describedby – for example hints or error messages -#}
{% set describedBy = "" %}
<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
  {{ govukLabel({
    html: params.label.html,
    text: params.label.text,
    classes: params.label.classes,
    isPageHeading: params.label.isPageHeading,
    attributes: params.label.attributes,
    for: params.id
  }) | indent(2) | trim }}
{% if params.hint %}
  {% set hintId = params.id + '-hint' %}
  {% set describedBy = describedBy + ' ' + hintId if describedBy else hintId %}
  {{ govukHint({
    id: hintId,
    classes: params.hint.classes,
    attributes: params.hint.attributes,
    html: params.hint.html,
    text: params.hint.text
  }) | indent(2) | trim }}
{% endif %}
{% if params.errorMessage %}
  {% set errorId = params.id + '-error' %}
  {% set describedBy = describedBy + ' ' + errorId if describedBy else errorId %}
  {{ govukErrorMessage({
    id: errorId,
    classes: params.errorMessage.classes,
    html: params.errorMessage.html,
    text: params.errorMessage.text
  }) | indent(2) | trim }}
{% endif %}
  <textarea class="govuk-textarea {{- ' govuk-textarea--error' if params.errorMessage }} {{- ' ' + params.classes if params.classes}}" id="{{ params.id }}" name="{{ params.name }}" rows="{%if params.rows %} {{- params.rows -}} {% else %}5{%endif %}"
  {%- if describedBy %} aria-describedby="{{ describedBy }}"{% endif %}
  {%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>{{ params.value }}</textarea>
</div>

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
govuk_publishing_components-12.20.0 node_modules/govuk-frontend/components/textarea/template.njk
govuk_publishing_components-12.19.0 node_modules/govuk-frontend/components/textarea/template.njk
govuk_publishing_components-12.18.0 node_modules/govuk-frontend/components/textarea/template.njk
govuk_publishing_components-12.17.0 node_modules/govuk-frontend/components/textarea/template.njk
govuk_publishing_components-12.16.0 node_modules/govuk-frontend/components/textarea/template.njk
govuk_publishing_components-12.15.0 node_modules/govuk-frontend/components/textarea/template.njk
govuk_publishing_components-12.14.1 node_modules/govuk-frontend/components/textarea/template.njk
govuk_publishing_components-12.14.0 node_modules/govuk-frontend/components/textarea/template.njk
govuk_publishing_components-12.13.0 node_modules/govuk-frontend/components/textarea/template.njk
govuk_publishing_components-12.12.1 node_modules/govuk-frontend/components/textarea/template.njk
govuk_publishing_components-12.12.0 node_modules/govuk-frontend/components/textarea/template.njk
govuk_publishing_components-12.11.0 node_modules/govuk-frontend/components/textarea/template.njk
govuk_publishing_components-12.10.0 node_modules/govuk-frontend/components/textarea/template.njk
govuk_publishing_components-12.9.1 node_modules/govuk-frontend/components/textarea/template.njk
govuk_publishing_components-12.9.0 node_modules/govuk-frontend/components/textarea/template.njk