Default
Starts 5 lines tall (136px). People drag the corner to make it taller, up and down only.
Lets people type a longer answer over several lines, such as a message, a complaint or a description.
Updated
Don't include your NIN, BVN or bank details
Textarea
Usage
<div class="nds-textarea"> <div class="nds-textarea__label-row"> <label class="nds-textarea__label" for="your-message"> Your message </label> <span class="nds-textarea__required" aria-hidden="true"> * </span> </div> <textarea class="nds-textarea__control" id="your-message" name="your-message" rows="5" required aria-describedby="your-message-hint" > I'd like to know the opening hours of the Ikeja office. </textarea> <p class="nds-textarea__hint" id="your-message-hint"> Don't include your NIN, BVN or bank details </p></div> WordPress
<!-- wp:nds/textarea {"rows":5} --><div class="nds-textarea"> <div class="nds-textarea__label-row"> <label class="nds-textarea__label" for="your-message"> Your message </label> <span class="nds-textarea__required" aria-hidden="true"> * </span> </div> <textarea class="nds-textarea__control" id="your-message" name="your-message" rows="5" required aria-describedby="your-message-hint" > I'd like to know the opening hours of the Ikeja office. </textarea> <p class="nds-textarea__hint" id="your-message-hint"> Don't include your NIN, BVN or bank details </p></div><!-- /wp:nds/textarea --> Usage
// Import the componentimport { Textarea } from "@nigerian-design-standards/react";// Use it<Textarea label="Your message" hint="Don't include your NIN, BVN or bank details" value="I'd like to know the opening hours of the Ikeja office." required/> Usage
// Import the componentuse NDS\Components\Textarea;// Use itecho Textarea::render([ 'label' => 'Your message', 'hint' => 'Don\'t include your NIN, BVN or bank details', 'value' => 'I\'d like to know the opening hours of the Ikeja office.', 'required' => true,]); A textarea lets people write an answer that runs over several lines. It starts 5 lines tall and people can make it taller.
A textarea starts 5 lines tall. With a character limit, the hint says so and counts down as people type.
Starts 5 lines tall (136px). People drag the corner to make it taller, up and down only.
2px border/dark while people type.
The error message takes the hint’s place and the border turns red.
The hint says the limit and counts down: “You have 446 characters remaining”.
The properties of Form/Textarea field. The same in HTML, WordPress and React.
| Property | Type | Possible values | Description |
|---|---|---|---|
| state | string |
| Active is the field in use: a 2px border/dark (not the keyboard focus ring). Error shows the message and a red border. Avoid disabled. |
| showHint | boolean |
| Help text under the label. Use it to say any character limit. |
| required | boolean |
|
Shows an asterisk in the label row and sets the native required attribute.
Use optional instead for “(optional)” when the field is not mandatory.
|
| rows | number |
| Starting height: 5 lines (136px). People can drag it taller; it scrolls after about 12 lines. |
| maxLength | number |
| Optional limit. Say it in the hint and count down as people type. |
In code, use a <textarea> with a <label for>, CSS resize: vertical, and aria-describedby for the hint, countdown or error.
Announce the countdown with aria-live="polite".
| Part | Token | Contrast on the page |
|---|---|---|
| Border | border/strong, 1px | 4.2:1 |
| Border when active | border/dark, 2px | 14.3:1 |
| Border in an error | status/error/surface, 1px (2px when active) | 4.9:1 |
| Typed text | text/primary, Body/medium (16px) | 17.6:1 |
| Disabled | surface/muted fill, border/subtle, text/disabled | Exempt |
| Size | 136px tall (5 lines) to about 304px, then it scrolls; radius/050 | — |
Don't include your NIN, BVN or bank details
Use the hint to say what not to include, or the limit. People see it before they start writing.
Don’t use a textarea for a short answer. A big box tells people to write a lot.
How the textarea is sized and how it grows.
How to write the label, the hint and the messages.
“Your message”, “What happened?”, “Describe the problem”.
Put it in the hint: “You can enter up to 500 characters”.
“You have 446 characters remaining”, then “You have 20 characters too many”.
“Don’t include your NIN, BVN or bank details”.
“Enter your message”, or “Your message must be 500 characters or fewer”.
After an error, keep the text so they only fix what’s wrong.
| Write | Don’t write | Why |
|---|---|---|
| Your message | Comments | Says what to write. |
| You can enter up to 500 characters | Max 500 chars | Plain words, before people start. |
| You have 20 characters too many | Too long | Says by how much. |
| Enter your message | This field is required | Says what to do. |
| Don’t include your NIN, BVN or bank details | No sensitive info | Names exactly what to leave out. |
Built on a native <textarea> with a visible <label>, so it
works with keyboards, screen readers and voice input.
| Key | What it does |
|---|---|
| Tab | Moves out of the textarea. It never adds a tab character. |
| Shift + Tab | Moves back to the previous field. |
| Enter | Adds a new line. It never submits the form. |
Copy the code for HTML, WordPress or React from the Code tab in Live example. The options are listed under Specifications.
Use Form/Textarea field from 01 Library – Foundations. Don’t detach it.
Is this page useful?