<div class="field">
<label for="message">Message</label>
<textarea id="message" name="message">
</textarea>
</div>
{% set ariaDescribedby = '' %}
{% if hint %}
{% set ariaDescribedby = name + '-hint' %}
{% elif error %}
{% set ariaDescribedby = name + '-error' %}
{% elif hint and error %}
{% set ariaDescribedby = name + '-hint' + " " + name + '-error' %}
{% endif %}
<div class="field{% if error %} field--error{% endif %}">
<label for="message">Message</label>
<textarea id="message" name="message"{% if ariaDescribedby != '' %}aria-describedby="{{ ariaDescribedby }}" {% endif %}{% if error %} aria-invalid="true"{% endif %}>
</textarea>
{%- if hint %}
{% render '@hint', { name: name, content: hint } %}
{%- endif %}
{%- if error %}
{% render '@error', { name: name, content: error } %}
{%- endif -%}
</div>
{
"name": "message",
"id": false,
"label": "Message",
"hint": false,
"error": false
}
Text areas have a flexible height and content scrolls vertically.
Labels and the corresponding text area are intended to be wrapped in a
containing element with a class of field.
A hint can be added immediately after the <label> in a paragraph with
a class of field__hint.
A validation error message can be added immediately after the <label>
or hint in a paragraph with a class of field__error.
Hints and validation error messages must be associated with the text area using
unique IDs which can be referenced from the text area’s aria-describedby
attribute. For more information, see WebAIM’s form validation error documentation.
Text areas with an associated error should also be given an aria-invalid
attribute of true.