Textarea
These nifty inputs allow our members to send us information
Remember, when working with forms, add the
aria-describedby
attribute, and some helpful text, to allow
a seamless experience for everybody.
Keep your form on a white background to enable full contrast ratios for form validation messages.
While using input type="number"
users could accidentally increase or decrease the number using the
scroll wheel on the mouse or the scroll gesture on their trackpad. This
feature can be useful when collecting countable data but bad if entering
data such as passport numbers. We have switched to
input type="text" inputmode="numeric" pattern="[0-9]*"
because it allows for a degree of separation between how the user enters
data (“input mode”), what the browser expects the user input to contain
(type equals number), and potentially how it tries to validate it.
How they look
Input fields
View demoView code
<form class="gg-c-form">
<label for="textareainput" class="gg-c-form__label">Textarea Input</label>
<div class="gg-c-form__element">
<div class="gg-c-form__textarea--container">
<textarea id="textareainput" class="gg-c-form__textarea" aria-describedby="textarea-message" cols="80" rows="3" maxlength="4000" placeholder="Your message here..."></textarea>
</div>
</div>
</form>
Input validation
View demoView code
<form class="gg-c-form">
<label for="textareainput" class="gg-c-form__label">Textarea Input</label>
<div class="gg-c-form__element gg-c-form__element--invalid">
<div class="gg-c-form__textarea--container">
<textarea id="textareainput" class="gg-c-form__textarea" aria-describedby="textarea-message" cols="80" rows="3" maxlength="4000" placeholder="Your message here..."></textarea>
</div>
<p class="gg-c-form__element-message gg-c-form__element-message--invalid">An example error message</p>
<p class="gg-c-form__element-message gg-c-form__element-message--invalid">Another example error message</p>
</div>
</form>