--- url: "https://design-system.service.gov.uk/components/textarea/" titulek: "Textarea – GOV.UK Design System" h1: "Textarea" popis: "Help users provide detailed information using the textarea component" jazyk: "en" kanonicka: "https://design-system.service.gov.uk/components/textarea/" drobecky: ["Home", "Components"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 01:22:10" znaku: 29389 slov: 4493 kodovani: "utf-8" sha256: "d735edc0c8119ee66b5fe754134478f7af42ee06a4cc6ace968157de4f81a766" --- # Textarea - HTML - Nunjucks HTML ```

Do not include personal or financial information, like your National Insurance number or credit card details
``` Nunjucks Nunjucks macro options Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text. Some options are required for the macro to work; these are marked as “Required” in the option description. Deprecated options are marked as “Deprecated”. If you’re using Nunjucks macros in production with “html” options, or ones ending with “html”, you must sanitise the HTML to protect against [cross-site scripting exploits](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting). Primary options string The ID of the textarea. Defaults to the value of `name`. string **Required.** The name of the textarea, which is submitted with the form data. boolean Optional field to enable or disable the `spellcheck` attribute on the textarea. string Optional number of textarea rows (default is 5 rows). string Optional initial value of the textarea. boolean If `true`, textarea will be disabled. string One or more element IDs to add to the `aria-describedby` attribute, used to provide additional descriptive information for screenreader users. object **Required.** The label used by the textarea component. See macro options for label. object Can be used to add a hint to the textarea component. See macro options for hint. object Can be used to add an error message to the textarea component. The error message component will not display if you use a falsy value for `errorMessage`, for example `false` or `null`. [See macro options for errorMessage](/components/error-message/#options-error-message-example). object Additional options for the form group containing the textarea component. See macro options for formGroup. string Classes to add to the textarea. string Attribute to meet [WCAG success criterion 1.3.5: Identify input purpose](https://www.w3.org/WAI/WCAG22/Understanding/identify-input-purpose.html), for instance `"bday-day"`. See the [Autofill section in the HTML standard](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill) section in the HTML standard for full list of attributes that can be used. object HTML attributes (for example data attributes) to add to the textarea. Options for `formGroup` object string Classes to add to the form group (for example to show error state for the whole group). object HTML attributes (for example data attributes) to add to the form group. object Content to add before the textarea used by the textarea component. See macro options for formGroup beforeInput. object Content to add after the textarea used by the textarea component. See macro options for formGroup afterInput. Options for formGroup `beforeInput` object string **Required.** Text to add before the textarea. If `html` is provided, the `text` option will be ignored. string **Required.** HTML to add before the textarea. If `html` is provided, the `text` option will be ignored. Options for formGroup `afterInput` object string **Required.** Text to add after the textarea. If `html` is provided, the `text` option will be ignored. string **Required.** HTML to add after the textarea. If `html` is provided, the `text` option will be ignored. Options for `label` component string **Required.** If `html` is set, this is not required. Text to use within the label. If `html` is provided, the `text` option will be ignored. string **Required.** If `text` is set, this is not required. HTML to use within the label. If `html` is provided, the `text` option will be ignored. string The value of the `for` attribute, the ID of the input the label is associated with. boolean Whether the label also acts as the heading for the page. string Classes to add to the label tag. object HTML attributes (for example data attributes) to add to the label tag. Options for `hint` component string **Required.** If `html` is set, this is not required. Text to use within the hint. If `html` is provided, the `text` option will be ignored. string **Required.** If `text` is set, this is not required. HTML to use within the hint. If `html` is provided, the `text` option will be ignored. string Optional ID attribute to add to the hint span tag. string Classes to add to the hint span tag. object HTML attributes (for example data attributes) to add to the hint span tag. ``` {% 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](/components/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](/components/text-input/). ## 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](https://mozilla.github.io/nunjucks/) or the [GOV.UK Prototype Kit](https://prototype-kit.service.gov.uk), you can use the Nunjucks macro. - HTML - Nunjucks HTML ```

Do not include personal or financial information, like your National Insurance number or credit card details
``` Nunjucks Nunjucks macro options Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text. Some options are required for the macro to work; these are marked as “Required” in the option description. Deprecated options are marked as “Deprecated”. If you’re using Nunjucks macros in production with “html” options, or ones ending with “html”, you must sanitise the HTML to protect against [cross-site scripting exploits](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting). Primary options string The ID of the textarea. Defaults to the value of `name`. string **Required.** The name of the textarea, which is submitted with the form data. boolean Optional field to enable or disable the `spellcheck` attribute on the textarea. string Optional number of textarea rows (default is 5 rows). string Optional initial value of the textarea. boolean If `true`, textarea will be disabled. string One or more element IDs to add to the `aria-describedby` attribute, used to provide additional descriptive information for screenreader users. object **Required.** The label used by the textarea component. See macro options for label. object Can be used to add a hint to the textarea component. See macro options for hint. object Can be used to add an error message to the textarea component. The error message component will not display if you use a falsy value for `errorMessage`, for example `false` or `null`. [See macro options for errorMessage](/components/error-message/#options-error-message-example). object Additional options for the form group containing the textarea component. See macro options for formGroup. string Classes to add to the textarea. string Attribute to meet [WCAG success criterion 1.3.5: Identify input purpose](https://www.w3.org/WAI/WCAG22/Understanding/identify-input-purpose.html), for instance `"bday-day"`. See the [Autofill section in the HTML standard](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill) section in the HTML standard for full list of attributes that can be used. object HTML attributes (for example data attributes) to add to the textarea. Options for `formGroup` object string Classes to add to the form group (for example to show error state for the whole group). object HTML attributes (for example data attributes) to add to the form group. object Content to add before the textarea used by the textarea component. See macro options for formGroup beforeInput. object Content to add after the textarea used by the textarea component. See macro options for formGroup afterInput. Options for formGroup `beforeInput` object string **Required.** Text to add before the textarea. If `html` is provided, the `text` option will be ignored. string **Required.** HTML to add before the textarea. If `html` is provided, the `text` option will be ignored. Options for formGroup `afterInput` object string **Required.** Text to add after the textarea. If `html` is provided, the `text` option will be ignored. string **Required.** HTML to add after the textarea. If `html` is provided, the `text` option will be ignored. Options for `label` component string **Required.** If `html` is set, this is not required. Text to use within the label. If `html` is provided, the `text` option will be ignored. string **Required.** If `text` is set, this is not required. HTML to use within the label. If `html` is provided, the `text` option will be ignored. string The value of the `for` attribute, the ID of the input the label is associated with. boolean Whether the label also acts as the heading for the page. string Classes to add to the label tag. object HTML attributes (for example data attributes) to add to the label tag. Options for `hint` component string **Required.** If `html` is set, this is not required. Text to use within the hint. If `html` is provided, the `text` option will be ignored. string **Required.** If `text` is set, this is not required. HTML to use within the hint. If `html` is provided, the `text` option will be ignored. string Optional ID attribute to add to the hint span tag. string Classes to add to the hint span tag. object HTML attributes (for example data attributes) to add to the hint span tag. ``` {% 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. - HTML - Nunjucks HTML ```

Do not include personal or financial information, like your National Insurance number or credit card details
``` Nunjucks Nunjucks macro options Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text. Some options are required for the macro to work; these are marked as “Required” in the option description. Deprecated options are marked as “Deprecated”. If you’re using Nunjucks macros in production with “html” options, or ones ending with “html”, you must sanitise the HTML to protect against [cross-site scripting exploits](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting). Primary options string The ID of the textarea. Defaults to the value of `name`. string **Required.** The name of the textarea, which is submitted with the form data. boolean Optional field to enable or disable the `spellcheck` attribute on the textarea. string Optional number of textarea rows (default is 5 rows). string Optional initial value of the textarea. boolean If `true`, textarea will be disabled. string One or more element IDs to add to the `aria-describedby` attribute, used to provide additional descriptive information for screenreader users. object **Required.** The label used by the textarea component. See macro options for label. object Can be used to add a hint to the textarea component. See macro options for hint. object Can be used to add an error message to the textarea component. The error message component will not display if you use a falsy value for `errorMessage`, for example `false` or `null`. [See macro options for errorMessage](/components/error-message/#options-error-message-example). object Additional options for the form group containing the textarea component. See macro options for formGroup. string Classes to add to the textarea. string Attribute to meet [WCAG success criterion 1.3.5: Identify input purpose](https://www.w3.org/WAI/WCAG22/Understanding/identify-input-purpose.html), for instance `"bday-day"`. See the [Autofill section in the HTML standard](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill) section in the HTML standard for full list of attributes that can be used. object HTML attributes (for example data attributes) to add to the textarea. Options for `formGroup` object string Classes to add to the form group (for example to show error state for the whole group). object HTML attributes (for example data attributes) to add to the form group. object Content to add before the textarea used by the textarea component. See macro options for formGroup beforeInput. object Content to add after the textarea used by the textarea component. See macro options for formGroup afterInput. Options for formGroup `beforeInput` object string **Required.** Text to add before the textarea. If `html` is provided, the `text` option will be ignored. string **Required.** HTML to add before the textarea. If `html` is provided, the `text` option will be ignored. Options for formGroup `afterInput` object string **Required.** Text to add after the textarea. If `html` is provided, the `text` option will be ignored. string **Required.** HTML to add after the textarea. If `html` is provided, the `text` option will be ignored. Options for `label` component string **Required.** If `html` is set, this is not required. Text to use within the label. If `html` is provided, the `text` option will be ignored. string **Required.** If `text` is set, this is not required. HTML to use within the label. If `html` is provided, the `text` option will be ignored. string The value of the `for` attribute, the ID of the input the label is associated with. boolean Whether the label also acts as the heading for the page. string Classes to add to the label tag. object HTML attributes (for example data attributes) to add to the label tag. Options for `hint` component string **Required.** If `html` is set, this is not required. Text to use within the hint. If `html` is provided, the `text` option will be ignored. string **Required.** If `text` is set, this is not required. HTML to use within the hint. If `html` is provided, the `text` option will be ignored. string Optional ID attribute to add to the hint span tag. string Classes to add to the hint span tag. object HTML attributes (for example data attributes) to add to the hint span tag. ``` {% 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 `