Chapter 04 Fields
Textarea
The multi-line twin of the text field: the same label, hint and error, with room for a few lines. The reader can make it taller.
import { TextareaComponent } from '@okaapi-ui/angular';
// Works with formControlName, [formControl] and ngModel.Works with
With a hint
Gate code, floor, anything the driver should know.
<ui-textarea
label="Delivery notes"
hint="Gate code, floor, anything the driver should know."
[rows]="4"
formControlName="notes"
/>With an error
Same rules as the text field: the message is announced, and the border thickens, so colour is never the only sign.
Tell us what went wrong
<ui-textarea
label="Reason for the refund"
formControlName="reason"
[error]="form.controls.reason.invalid ? 'Tell us what went wrong' : undefined"
/>In Arabic
كود البوابة، الدور، أي حاجة السواق محتاج يعرفها.
<!-- dir="rtl" on the page or any ancestor -->
<ui-textarea label="ملاحظات التوصيل" hint="كود البوابة، الدور، أي حاجة السواق محتاج يعرفها." />When to use something else
| If you need | Use |
|---|---|
| One line of text | Text field |
Inputs
| Name | Type | Default | What it does |
|---|---|---|---|
label | string | — | Required. The visible label, tied to the textarea. |
rows | number | 3 | Height in lines. The reader can still make it taller. |
maxlength | number | — | The most characters it accepts. |
hint | string | — | Help text under the textarea, read with it. |
error | string | — | The translated error. Marks the textarea invalid and announces the message. |
testId | string | — | data-testid on the textarea, for tests. |
Keyboard and screen readers
- The same label, hint and error as the text field, all read with it.