<h1class="govuk-label-wrapper"><labelclass="govuk-label govuk-label--l"for="more-detail">
Can you provide more detail?
</label></h1><divid="more-detail-hint"class="govuk-hint">
Do not include personal or financial information, like your National Insurance number or credit card details.
</div><textareaclass="govuk-textarea"id="more-detail"name="more-detail"rows="5"aria-describedby="more-detail-hint"></textarea></div>
<p>
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
</p>
<p>
Some options are required for the macro to work; these are marked as "Required" in the option description.
</p>
<p>
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against <a href="https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting">cross-site scripting exploits</a>.
</p>
<table class="govuk-table app-options__table" id="options-textarea-example--primary">
<caption class="govuk-table__caption govuk-heading-m govuk-visually-hidden">Primary options</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">id</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
The ID of the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">name</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
The name of the textarea, which is submitted with the form data.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">spellcheck</th>
<td class="govuk-table__cell ">boolean</td>
<td class="govuk-table__cell ">
Optional field to enable or disable the <code>spellcheck</code> attribute on the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">rows</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional number of textarea rows (default is 5 rows).
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">value</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional initial value of the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">describedBy</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
One or more element IDs to add to the <code>aria-describedby</code> attribute, used to provide additional descriptive information for screenreader users.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">label</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
Options for the label component.
See <a href="#options-textarea-example--label">label</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">hint</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the hint component.
See <a href="#options-textarea-example--hint">hint</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">errorMessage</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the error message component. The error message component will not display if you use a falsy value for <code>errorMessage</code>, for example <code>false</code> or <code>null</code>.
See <a href="/components/error-message/#options-error-message-example">errorMessage</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">formGroup</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the form-group wrapper.
See <a href="#options-textarea-example--formGroup">formGroup</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">autocomplete</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Attribute to <a href="https://www.w3.org/WAI/WCAG21/Understanding/identify-input-purpose.html">identify input purpose</a>, for example <code>postal-code</code> or <code>username</code>. See <a href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill">autofill</a> for full list of attributes that can be used.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the textarea.
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-textarea-example--formGroup">
<caption class="govuk-table__caption govuk-heading-m ">Options for formGroup</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the form group (for example to show error state for the whole group).
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-textarea-example--label">
<caption class="govuk-table__caption govuk-heading-m ">Options for label</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">text</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>html</code> is set, this is not required. Text to use within the label. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">html</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>text</code> is set, this is not required. HTML to use within the label. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">for</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
The value of the <code>for</code> attribute, the ID of the input the label is associated with.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">isPageHeading</th>
<td class="govuk-table__cell ">boolean</td>
<td class="govuk-table__cell ">
Whether the label also acts as the heading for the page.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the label tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the label tag.
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-textarea-example--hint">
<caption class="govuk-table__caption govuk-heading-m ">Options for hint</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">text</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>html</code> is set, this is not required. Text to use within the hint. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">html</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>text</code> is set, this is not required. HTML to use within the hint. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">id</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional ID attribute to add to the hint span tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the hint span tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the hint span tag.
</td>
</tr>
</tbody>
</table>
{{ govukTextarea({
name: "more-detail",
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 radios.
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.
<h1class="govuk-label-wrapper"><labelclass="govuk-label govuk-label--l"for="more-detail">
Can you provide more detail?
</label></h1><divid="more-detail-hint"class="govuk-hint">
Do not include personal or financial information, like your National Insurance number or credit card details.
</div><textareaclass="govuk-textarea"id="more-detail"name="more-detail"rows="5"aria-describedby="more-detail-hint"></textarea></div>
<p>
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
</p>
<p>
Some options are required for the macro to work; these are marked as "Required" in the option description.
</p>
<p>
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against <a href="https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting">cross-site scripting exploits</a>.
</p>
<table class="govuk-table app-options__table" id="options-textarea-second-example--primary">
<caption class="govuk-table__caption govuk-heading-m govuk-visually-hidden">Primary options</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">id</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
The ID of the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">name</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
The name of the textarea, which is submitted with the form data.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">spellcheck</th>
<td class="govuk-table__cell ">boolean</td>
<td class="govuk-table__cell ">
Optional field to enable or disable the <code>spellcheck</code> attribute on the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">rows</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional number of textarea rows (default is 5 rows).
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">value</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional initial value of the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">describedBy</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
One or more element IDs to add to the <code>aria-describedby</code> attribute, used to provide additional descriptive information for screenreader users.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">label</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
Options for the label component.
See <a href="#options-textarea-second-example--label">label</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">hint</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the hint component.
See <a href="#options-textarea-second-example--hint">hint</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">errorMessage</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the error message component. The error message component will not display if you use a falsy value for <code>errorMessage</code>, for example <code>false</code> or <code>null</code>.
See <a href="/components/error-message/#options-error-message-example">errorMessage</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">formGroup</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the form-group wrapper.
See <a href="#options-textarea-second-example--formGroup">formGroup</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">autocomplete</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Attribute to <a href="https://www.w3.org/WAI/WCAG21/Understanding/identify-input-purpose.html">identify input purpose</a>, for example <code>postal-code</code> or <code>username</code>. See <a href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill">autofill</a> for full list of attributes that can be used.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the textarea.
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-textarea-second-example--formGroup">
<caption class="govuk-table__caption govuk-heading-m ">Options for formGroup</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the form group (for example to show error state for the whole group).
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-textarea-second-example--label">
<caption class="govuk-table__caption govuk-heading-m ">Options for label</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">text</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>html</code> is set, this is not required. Text to use within the label. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">html</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>text</code> is set, this is not required. HTML to use within the label. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">for</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
The value of the <code>for</code> attribute, the ID of the input the label is associated with.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">isPageHeading</th>
<td class="govuk-table__cell ">boolean</td>
<td class="govuk-table__cell ">
Whether the label also acts as the heading for the page.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the label tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the label tag.
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-textarea-second-example--hint">
<caption class="govuk-table__caption govuk-heading-m ">Options for hint</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">text</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>html</code> is set, this is not required. Text to use within the hint. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">html</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>text</code> is set, this is not required. HTML to use within the hint. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">id</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional ID attribute to add to the hint span tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the hint span tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the hint span tag.
</td>
</tr>
</tbody>
</table>
{{ govukTextarea({
name: "more-detail",
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 by specifying the rows attribute.
<h1class="govuk-label-wrapper"><labelclass="govuk-label govuk-label--l"for="more-detail">
Can you provide more detail?
</label></h1><divid="more-detail-hint"class="govuk-hint">
Do not include personal or financial information, like your National Insurance number or credit card details.
</div><textareaclass="govuk-textarea"id="more-detail"name="more-detail"rows="8"aria-describedby="more-detail-hint"></textarea></div>
<p>
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
</p>
<p>
Some options are required for the macro to work; these are marked as "Required" in the option description.
</p>
<p>
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against <a href="https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting">cross-site scripting exploits</a>.
</p>
<table class="govuk-table app-options__table" id="options-textarea-appropriately-sized-with-rows-example--primary">
<caption class="govuk-table__caption govuk-heading-m govuk-visually-hidden">Primary options</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">id</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
The ID of the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">name</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
The name of the textarea, which is submitted with the form data.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">spellcheck</th>
<td class="govuk-table__cell ">boolean</td>
<td class="govuk-table__cell ">
Optional field to enable or disable the <code>spellcheck</code> attribute on the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">rows</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional number of textarea rows (default is 5 rows).
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">value</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional initial value of the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">describedBy</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
One or more element IDs to add to the <code>aria-describedby</code> attribute, used to provide additional descriptive information for screenreader users.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">label</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
Options for the label component.
See <a href="#options-textarea-appropriately-sized-with-rows-example--label">label</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">hint</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the hint component.
See <a href="#options-textarea-appropriately-sized-with-rows-example--hint">hint</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">errorMessage</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the error message component. The error message component will not display if you use a falsy value for <code>errorMessage</code>, for example <code>false</code> or <code>null</code>.
See <a href="/components/error-message/#options-error-message-example">errorMessage</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">formGroup</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the form-group wrapper.
See <a href="#options-textarea-appropriately-sized-with-rows-example--formGroup">formGroup</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">autocomplete</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Attribute to <a href="https://www.w3.org/WAI/WCAG21/Understanding/identify-input-purpose.html">identify input purpose</a>, for example <code>postal-code</code> or <code>username</code>. See <a href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill">autofill</a> for full list of attributes that can be used.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the textarea.
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-textarea-appropriately-sized-with-rows-example--formGroup">
<caption class="govuk-table__caption govuk-heading-m ">Options for formGroup</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the form group (for example to show error state for the whole group).
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-textarea-appropriately-sized-with-rows-example--label">
<caption class="govuk-table__caption govuk-heading-m ">Options for label</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">text</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>html</code> is set, this is not required. Text to use within the label. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">html</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>text</code> is set, this is not required. HTML to use within the label. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">for</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
The value of the <code>for</code> attribute, the ID of the input the label is associated with.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">isPageHeading</th>
<td class="govuk-table__cell ">boolean</td>
<td class="govuk-table__cell ">
Whether the label also acts as the heading for the page.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the label tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the label tag.
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-textarea-appropriately-sized-with-rows-example--hint">
<caption class="govuk-table__caption govuk-heading-m ">Options for hint</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">text</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>html</code> is set, this is not required. Text to use within the hint. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">html</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>text</code> is set, this is not required. HTML to use within the hint. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">id</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional ID attribute to add to the hint span tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the hint span tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the hint span tag.
</td>
</tr>
</tbody>
</table>
{{ govukTextarea({
name: "more-detail",
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="app-example app-example--tabs">
<div class="app-example__toolbar">
<a href="/components/textarea/without-heading/index.html" class="app-example__new-window" target="_blank">
Open this
<span class="govuk-visually-hidden">textarea without a heading</span>
example in a new tab
</a>
</div>
<iframe title="Textarea without a heading example" data-module="app-example-frame" class="app-example__frame app-example__frame--resizable app-example__frame--l" src="/components/textarea/without-heading/index.html" frameBorder="0" loading="lazy"></iframe>
</div>
<span id="options-textarea-without-a-heading-example"></span>
<ul class="app-tabs" role="tablist">
<li class="app-tabs__item js-tabs__item" role="presentation"><a href="#textarea-without-a-heading-example-html" role="tab" aria-controls="textarea-without-a-heading-example-html" data-track="tab-html">HTML</a></li>
<li class="app-tabs__item js-tabs__item" role="presentation"><a href="#textarea-without-a-heading-example-nunjucks" role="tab" aria-controls="textarea-without-a-heading-example-nunjucks" data-track="tab-nunjucks">Nunjucks</a></li>
</ul>
<div class="app-tabs__heading js-tabs__heading"><a href="#textarea-without-a-heading-example-html" aria-controls="textarea-without-a-heading-example-html" data-track="tab-html">HTML</a></div>
<div class="app-tabs__container js-tabs__container" id="textarea-without-a-heading-example-html" role="tabpanel">
<div class="app-example__code">
<pre data-module="app-copy" tabindex="0"><code class="hljs html"><span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"govuk-form-group"</span>></span>
<labelclass="govuk-label"for="more-detail">
Can you provide more detail?
</label><textareaclass="govuk-textarea"id="more-detail"name="more-detail"rows="5"></textarea></div>
<p>
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
</p>
<p>
Some options are required for the macro to work; these are marked as "Required" in the option description.
</p>
<p>
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against <a href="https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting">cross-site scripting exploits</a>.
</p>
<table class="govuk-table app-options__table" id="options-textarea-without-a-heading-example--primary">
<caption class="govuk-table__caption govuk-heading-m govuk-visually-hidden">Primary options</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">id</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
The ID of the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">name</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
The name of the textarea, which is submitted with the form data.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">spellcheck</th>
<td class="govuk-table__cell ">boolean</td>
<td class="govuk-table__cell ">
Optional field to enable or disable the <code>spellcheck</code> attribute on the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">rows</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional number of textarea rows (default is 5 rows).
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">value</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional initial value of the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">describedBy</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
One or more element IDs to add to the <code>aria-describedby</code> attribute, used to provide additional descriptive information for screenreader users.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">label</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
Options for the label component.
See <a href="#options-textarea-without-a-heading-example--label">label</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">hint</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the hint component.
See <a href="#options-textarea-without-a-heading-example--hint">hint</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">errorMessage</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the error message component. The error message component will not display if you use a falsy value for <code>errorMessage</code>, for example <code>false</code> or <code>null</code>.
See <a href="/components/error-message/#options-error-message-example">errorMessage</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">formGroup</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the form-group wrapper.
See <a href="#options-textarea-without-a-heading-example--formGroup">formGroup</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">autocomplete</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Attribute to <a href="https://www.w3.org/WAI/WCAG21/Understanding/identify-input-purpose.html">identify input purpose</a>, for example <code>postal-code</code> or <code>username</code>. See <a href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill">autofill</a> for full list of attributes that can be used.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the textarea.
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-textarea-without-a-heading-example--formGroup">
<caption class="govuk-table__caption govuk-heading-m ">Options for formGroup</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the form group (for example to show error state for the whole group).
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-textarea-without-a-heading-example--label">
<caption class="govuk-table__caption govuk-heading-m ">Options for label</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">text</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>html</code> is set, this is not required. Text to use within the label. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">html</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>text</code> is set, this is not required. HTML to use within the label. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">for</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
The value of the <code>for</code> attribute, the ID of the input the label is associated with.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">isPageHeading</th>
<td class="govuk-table__cell ">boolean</td>
<td class="govuk-table__cell ">
Whether the label also acts as the heading for the page.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the label tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the label tag.
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-textarea-without-a-heading-example--hint">
<caption class="govuk-table__caption govuk-heading-m ">Options for hint</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">text</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>html</code> is set, this is not required. Text to use within the hint. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">html</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>text</code> is set, this is not required. HTML to use within the hint. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">id</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional ID attribute to add to the hint span tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the hint span tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the hint span tag.
</td>
</tr>
</tbody>
</table>
<h1class="govuk-label-wrapper"><labelclass="govuk-label govuk-label--l"for="more-detail">
Can you provide more detail?
</label></h1><divid="more-detail-hint"class="govuk-hint">
Do not include personal or financial information, like your National Insurance number or credit card details.
</div><pid="more-detail-error"class="govuk-error-message"><spanclass="govuk-visually-hidden">Error:</span> Enter more detail
</p><textareaclass="govuk-textarea govuk-textarea--error"id="more-detail"name="more-detail"rows="5"aria-describedby="more-detail-hint more-detail-error"></textarea></div>
<p>
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
</p>
<p>
Some options are required for the macro to work; these are marked as "Required" in the option description.
</p>
<p>
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against <a href="https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting">cross-site scripting exploits</a>.
</p>
<table class="govuk-table app-options__table" id="options-textarea-with-error-example--primary">
<caption class="govuk-table__caption govuk-heading-m govuk-visually-hidden">Primary options</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">id</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
The ID of the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">name</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
The name of the textarea, which is submitted with the form data.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">spellcheck</th>
<td class="govuk-table__cell ">boolean</td>
<td class="govuk-table__cell ">
Optional field to enable or disable the <code>spellcheck</code> attribute on the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">rows</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional number of textarea rows (default is 5 rows).
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">value</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional initial value of the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">describedBy</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
One or more element IDs to add to the <code>aria-describedby</code> attribute, used to provide additional descriptive information for screenreader users.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">label</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
Options for the label component.
See <a href="#options-textarea-with-error-example--label">label</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">hint</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the hint component.
See <a href="#options-textarea-with-error-example--hint">hint</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">errorMessage</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the error message component. The error message component will not display if you use a falsy value for <code>errorMessage</code>, for example <code>false</code> or <code>null</code>.
See <a href="/components/error-message/#options-error-message-example">errorMessage</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">formGroup</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the form-group wrapper.
See <a href="#options-textarea-with-error-example--formGroup">formGroup</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the textarea.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">autocomplete</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Attribute to <a href="https://www.w3.org/WAI/WCAG21/Understanding/identify-input-purpose.html">identify input purpose</a>, for example <code>postal-code</code> or <code>username</code>. See <a href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill">autofill</a> for full list of attributes that can be used.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the textarea.
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-textarea-with-error-example--formGroup">
<caption class="govuk-table__caption govuk-heading-m ">Options for formGroup</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the form group (for example to show error state for the whole group).
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-textarea-with-error-example--label">
<caption class="govuk-table__caption govuk-heading-m ">Options for label</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">text</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>html</code> is set, this is not required. Text to use within the label. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">html</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>text</code> is set, this is not required. HTML to use within the label. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">for</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
The value of the <code>for</code> attribute, the ID of the input the label is associated with.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">isPageHeading</th>
<td class="govuk-table__cell ">boolean</td>
<td class="govuk-table__cell ">
Whether the label also acts as the heading for the page.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the label tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the label tag.
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-textarea-with-error-example--hint">
<caption class="govuk-table__caption govuk-heading-m ">Options for hint</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">text</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>html</code> is set, this is not required. Text to use within the hint. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">html</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>text</code> is set, this is not required. HTML to use within the hint. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">id</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional ID attribute to add to the hint span tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the hint span tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the hint span tag.
</td>
</tr>
</tbody>
</table>
{{ govukTextarea({
name: "more-detail",
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 error message 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.
Help improve this component
To help make sure that this page is useful, relevant and up to date, you can: