Textarea
<div class="govuk-form-group">
<h1 class="govuk-label-wrapper">
<label class="govuk-label govuk-label--l" for="more-detail">
Can you provide more detail?
</label>
</h1>
<div id="more-detail-hint" class="govuk-hint">
Do not include personal or financial information, like your National Insurance number or credit card details
</div>
<textarea class="govuk-textarea" id="more-detail" name="moreDetail" rows="5" aria-describedby="more-detail-hint"></textarea>
</div>
See options and how to use with Nunjucks
{% from "govuk/components/textarea/macro.njk" import govukTextarea %}
{{ govukTextarea({
name: "moreDetail",
id: "more-detail",
label: {
text: "Can you provide more detail?",
classes: "govuk-label--l",
isPageHeading: true
},
hint: {
text: "Do not include personal or financial information, like your National Insurance number or credit card details"
}
}) }}
When to use this component
Use the textarea component when you need to let users enter an amount of text that’s longer than a single line.
When not to use this component
Users can find open-ended questions difficult to answer. It might be better to break up one complex question into a series of simple ones, for example where users can select from options using a Radios component.
If you need to ask an open question
Do not use the textarea component if you need to let users enter shorter answers no longer than a single line, such as a phone number or name. In this case, you should use the Text input component.
How it works
You must label textareas. Placeholder text is not a suitable substitute for a label, as it disappears when users click inside the textarea.
Labels must be aligned above the textarea they refer to. They should be short, direct and written in sentence case. Do not use colons at the end of labels.
There are 2 ways to use the textarea component. You can use HTML or, if you’re using Nunjucks or the GOV.UK Prototype Kit, you can use the Nunjucks macro.
<div class="govuk-form-group">
<h1 class="govuk-label-wrapper">
<label class="govuk-label govuk-label--l" for="more-detail">
Can you provide more detail?
</label>
</h1>
<div id="more-detail-hint" class="govuk-hint">
Do not include personal or financial information, like your National Insurance number or credit card details
</div>
<textarea class="govuk-textarea" id="more-detail" name="moreDetail" rows="5" aria-describedby="more-detail-hint"></textarea>
</div>
See options and how to use with Nunjucks
{% from "govuk/components/textarea/macro.njk" import govukTextarea %}
{{ govukTextarea({
name: "moreDetail",
id: "more-detail",
label: {
text: "Can you provide more detail?",
classes: "govuk-label--l",
isPageHeading: true
},
hint: {
text: "Do not include personal or financial information, like your National Insurance number or credit card details"
}
}) }}
Use appropriately-sized textareas
Make the height of a textarea proportional to the amount of text you expect users to enter. You can set the height of a textarea by specifying the rows attribute.
<div class="govuk-form-group">
<h1 class="govuk-label-wrapper">
<label class="govuk-label govuk-label--l" for="more-detail">
Can you provide more detail?
</label>
</h1>
<div id="more-detail-hint" class="govuk-hint">
Do not include personal or financial information, like your National Insurance number or credit card details
</div>
<textarea class="govuk-textarea" id="more-detail" name="moreDetail" rows="8" aria-describedby="more-detail-hint"></textarea>
</div>
See options and how to use with Nunjucks
{% from "govuk/components/textarea/macro.njk" import govukTextarea %}
{{ govukTextarea({
name: "moreDetail",
id: "more-detail",
rows: "8",
label: {
text: "Can you provide more detail?",
classes: "govuk-label--l",
isPageHeading: true
},
hint: {
text: "Do not include personal or financial information, like your National Insurance number or credit card details"
}
}) }}
Do not disable copy and paste
Users will often need to copy and paste information into a textarea, so do not stop them from doing this.
If you’re asking more than one question on the page
If you’re asking more than one question on the page, do not set the contents of the <label> as the page heading. Read more about asking multiple questions on Question pages.
<div class="govuk-form-group">
<label class="govuk-label" for="more-detail">
Can you provide more detail?
</label>
<textarea class="govuk-textarea" id="more-detail" name="moreDetail" rows="5"></textarea>
</div>
See options and how to use with Nunjucks
{% from "govuk/components/textarea/macro.njk" import govukTextarea %}
{{ govukTextarea({
name: "moreDetail",
id: "more-detail",
label: {
text: "Can you provide more detail?"
}
}) }}
Limiting the number of characters
If there’s a good reason to limit the number of characters users can enter, you can use the Character count component.
Error messages
Error messages should be styled like this:
<div class="govuk-form-group govuk-form-group--error">
<h1 class="govuk-label-wrapper">
<label class="govuk-label govuk-label--l" for="more-detail">
Can you provide more detail?
</label>
</h1>
<div id="more-detail-hint" class="govuk-hint">
Do not include personal or financial information, like your National Insurance number or credit card details
</div>
<p id="more-detail-error" class="govuk-error-message">
<span class="govuk-visually-hidden">Error:</span> Enter more detail
</p>
<textarea class="govuk-textarea govuk-textarea--error" id="more-detail" name="moreDetail" rows="5" aria-describedby="more-detail-hint more-detail-error"></textarea>
</div>
See options and how to use with Nunjucks
{% from "govuk/components/textarea/macro.njk" import govukTextarea %}
{{ govukTextarea({
name: "moreDetail",
id: "more-detail",
label: {
text: "Can you provide more detail?",
classes: "govuk-label--l",
isPageHeading: true
},
hint: {
text: "Do not include personal or financial information, like your National Insurance number or credit card details"
},
errorMessage: {
text: "Enter more detail"
}
}) }}
Make sure errors follow the guidance in the Error message component and have specific error messages for specific error states.
If the input is empty
Say ‘Enter [whatever it is]’.
For example, ‘Enter summary’.
If the input is too long
Say ‘[whatever it is] must be [number] characters or less’.
For example, ‘Summary must be 400 characters or less’.
If the input is too short
Say ‘[whatever it is] must be [number] characters or more’.
For example, ‘Summary must be 10 characters or more’.
If the input is too long or too short
Say ‘[whatever it is] must be between [number] and [number] characters’.
For example, ‘Summary must be between 10 and 400 characters’.
If the input uses characters that are not allowed and you know what the characters are
Say ‘[whatever it is] must not include [characters]’.
For example, ‘Summary must not include è and £’.
If the input uses characters that are not allowed and you do not know what the characters are
Say ‘[whatever it is] must only include [list of allowed characters]’.
For example, ‘Summary must only include letters a to z, hyphens, spaces and apostrophes.
Recent changes
| Date | Changed | Description |
|---|---|---|
| Mar 2025 | GOV.UK Frontend v5.9.0 | Changed component |
| Apr 2023 | GOV.UK Frontend v4.6.0 | Added |
| Jul 2020 | GOV.UK Frontend v3.8.0 | Added Updated component’s border thickness when in the error state. |
| Jan 2019 | GOV.UK Frontend v2.6.0 | Added |
| Oct 2018 | Guidance | Added advice on breaking complex, open-ended questions into multiple simple questions. Added a link to the Character count component for guidance on limiting the number of characters a user enters. |
Help improve this component
To help make sure that this page is useful, relevant and up to date, you can:
- take part in the ‘Textarea’ discussion on GitHub and share your research
- propose a change on GitHub – read more about how to propose changes in GitHub
Need help?
If you’ve got a question about the GOV.UK Design System, contact the team.