Skip to main content

Text area

Use the text area component when you need to let users enter an amount of text that’s longer than a single line. If you need to let users enter shorter answers no longer than a single line, such as a phone number or name, use the text input component.

Do not use the text area to ask a complex question. Split it into simple questions, where you can use text input or radio button components instead.

Use appropriately sized text areas

Think about how much text you expect a user to enter. The default height of the text area component is 140px. You can change this, if you expect the user to enter more or less text, using the min-height attribute.

The area expands automatically if the user enters an amount of text that’s larger than the size you’ve set.

<div class="text-area field">
<div class="bcc-form-question">
<label class="field__label field__label--block text-area__label"
>Give details of the support you provide</label
>
</div>
<textarea
id="description"
class="text-area__input field__input"
name="Give details of the support you provide"
maxlength="10000"
style="min-height: 140px;"
></textarea>
</div>

With hint text

<div class="text-area field">
<div class="bcc-form-question">
<label class="field__label field__label--block text-area__label">
What's the problem about?
<h6 class="field__instructions">
For example, mental health, personal care or difficult behaviour
</h6>
</label>
</div>
<textarea
id="description"
class="text-area__input field__input"
name="Give details of the support you provide"
maxlength="10000"
></textarea>
</div>

With word count

You can add a word count to a text area so a user knows how much more they can enter, when there is a limit.

Users can enter or paste in more than the word count. They then get a warning rather than losing any of it, allowing them to edit their text down.

You have 68 words remaining

<div class="text-area field">
<div class="bcc-form-question">
<label class="field__label field__label--block text-area__label">
What's the problem about?
<h6 class="field__instructions">
For example, mental health, personal care or difficult behaviour
</h6>
</label>
</div>
<textarea
id="description"
class="text-area__input field__input"
name="Give details of the support you provide"
maxlength="10000"
></textarea>
<p
class="field__instructions text-area__word-count"
id="word-count-instructions"
></p>
</div>

With error

Display an inline error when there's something wrong.

Example 1

If the question is mandatory and the user hasn’t entered any text.

You need to enter details of the support you provide
<div class="text-area field" id="textarea-field">
<div class="bcc-form-question">
<label class="field__label field__label--block text-area__label">
Give details of the support you provide
<h6 class="field__instructions" id="hint">
For example, mental health, personal care, or difficult behaviour
</h6>
</label>
</div>
<textarea
id="description"
class="text-area__input field__input"
name="description"
maxlength="10000"
></textarea>
<div class="field__message field__instructions__error" id="error-message">
You need to enter details of the support you provide.
</div>
</div>

Example 2

If the user tries to submit an amount of words when they’ve exceeded the word limit, show an error message that tells them by how many.

Your description must be 50 words or less

You have 16 words too many

<div class="text-area field field--error" id="textarea-field">
<div class="bcc-form-question">
<label
class="field__label field__label--block text-area__label"
>
Give details of the support you provide
<h6 class="field__instructions field__instructions__error" id="hint">
For example, mental health, personal care or difficult behaviour
</h6>
</label>
</div>
<div
id="error-message"
class="field__message field__instructions__error text-area__bold text-area__label"
>
Your description must be 50 words or less
</div>
<textarea
aria-describedby="description-error"
required=""
id="description"
class="text-area__input field__input"
name="description"
maxlength="10000"
>
I provide thorough and empathetic support for individuals facing mental health challenges, personal care needs, or difficult behaviours. This support includes helping with daily tasks, managing personal hygiene, addressing challenging behaviours, and promoting mental well-being. My goal is to encourage independence, build resilience, and create a positive environment for personal growth. I work in close consultation with the family and friends of each person I treat </textarea
>
<p
class="field__instructions field__instructions__error text-area__word-count text-area__bold"
id="word-count-instructions"
></p>
</div>