<divid="more-detail"class="govuk-form-group"><labelfor="more-detail-input"class="govuk-label"aria-hidden="false"><h1class="govuk-heading-l">
Can you provide more detail?
</h1></label><divid="more-detail-hint"class="govuk-hint"aria-hidden="false">
Do not include personal or financial information,
like your National Insurance number or credit card
details.
</div><textareaname="more-detail"aria-describedby="more-detail-hint"class="govuk-textarea"id="more-detail-input"rows="5"></textarea></div>
<Textareahint="Do not include personal or financial information, like your National Insurance number or credit card details."label={<h1className="govuk-heading-l">
Can you provide more detail?
</h1>}name="more-detail"/>
Props
Name
Type
Default
Description
id
string
-
'id' attribute to place on the base HTML element
classBlock
string
-
Block name override in BEM style classes applied to all elements
classModifiers
Modifiers
[]
BEM style modifiers to apply to the base HTML element
className
string
-
Extra classes to apply to the base HTML element
error
ReactNode
-
Error message
hint
ReactNode
-
Hint
label
ReactNode
-
REQUIRED. Label
width
number
-
Width of the field in characters (approximate)
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.
Do not include personal or financial information, like your National Insurance number or credit card details.
<divid="more-detail"class="govuk-form-group"><labelfor="more-detail-input"class="govuk-label"aria-hidden="false"><h1class="govuk-heading-l">
Can you provide more detail?
</h1></label><divid="more-detail-hint"class="govuk-hint"aria-hidden="false">
Do not include personal or financial information,
like your National Insurance number or credit card
details.
</div><textareaname="more-detail"aria-describedby="more-detail-hint"class="govuk-textarea"id="more-detail-input"rows="5"></textarea></div>
<Textareahint="Do not include personal or financial information, like your National Insurance number or credit card details."label={<h1className="govuk-heading-l">
Can you provide more detail?
</h1>}name="more-detail"/>
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.
Do not include personal or financial information, like your National Insurance number or credit card details.
<divid="more-detail"class="govuk-form-group"><labelfor="more-detail-input"class="govuk-label"aria-hidden="false"><h1class="govuk-heading-l">
Can you provide more detail?
</h1></label><divid="more-detail-hint"class="govuk-hint"aria-hidden="false">
Do not include personal or financial information,
like your National Insurance number or credit card
details.
</div><textareaname="more-detail"aria-describedby="more-detail-hint"class="govuk-textarea"id="more-detail-input"rows="8"></textarea></div>
<Textareahint="Do not include personal or financial information, like your National Insurance number or credit card details."label={<h1className="govuk-heading-l">
Can you provide more detail?
</h1>}name="more-detail"rows="8"/>
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.
<divid="more-detail"class="govuk-form-group"><labelfor="more-detail-input"class="govuk-label"aria-hidden="false">
Can you provide more detail?
</label><textareaname="more-detail"class="govuk-textarea"id="more-detail-input"rows="5"></textarea></div>
<Textarealabel="Can you provide more detail?"name="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:
Do not include personal or financial information, like your National Insurance number or credit card details.
<divid="more-detail"class="govuk-form-group govuk-form-group--error"><labelfor="more-detail-input"class="govuk-label"aria-hidden="false"><h1class="govuk-heading-l">
Can you provide more detail?
</h1></label><divid="more-detail-hint"class="govuk-hint"aria-hidden="false">
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"aria-hidden="false"><spanclass="govuk-visually-hidden">Error:</span>
Enter more detail
</p><textareaname="more-detail"aria-describedby="more-detail-hint more-detail-error"class="govuk-textarea govuk-textarea--error"id="more-detail-input"rows="5"></textarea></div>
<Textareaerror="Enter more detail"hint="Do not include personal or financial information, like your National Insurance number or credit card details."label={<h1className="govuk-heading-l">
Can you provide more detail?
</h1>}name="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 fewer’.
For example, ‘Summary must be 400 characters or fewer’.
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.