Skip to content

Textarea ​

A field for text that takes several lines.

The courier reads it before leaving

Set the height in lines with rows.

Installation ​

ts
import { NuiTextarea } from '@numior/kit';

Usage ​

Change the number of rows and the states of the field.

Number of visible rows.

resize
Whether the user can resize the field: vertically, both ways or not at all.
size
Changes the size of the control: sm, md or lg. The theme density shifts the height of each size.

Label of the control. Inside NuiField the field provides the label.

Hint below the control. Screen readers announce it with the control.

Error text below the control. Puts the control into the error state.

Examples ​

Let the user resize the field ​

Pick the direction in resize.

By default only the height changes, and none fixes the size.

Update the model after typing ​

Add the .lazy modifier.

The order has no note yet

While text is typed through an input method editor, the model does not change: the value reaches it when the composition ends.

The text reaches the model when the user leaves the field, and .trim drops the spaces at both ends.

Accessibility ​

The field is a native <textarea>, and attributes and event handlers go straight to it. A screen reader reads the label, the hint and the error together with the field.

API ​

Props

Name
Type
Default
Description
rows
number
3
Number of visible rows.
resize
NuiTextareaResize
"vertical"
Whether the user can resize the field: vertically, both ways or not at all.
id
string
—
Id of the control. Defaults to the one from NuiField or is generated automatically.
size
NuiSize
"md"
Changes the size of the control: sm, md or lg. The theme density shifts the height of each size.
disabled
boolean
—
Disables the control. Inside NuiField it defaults to the field value.
readonly
boolean
—
Blocks typing. The text can still be selected and copied.
required
boolean
—
Marks the control as required. Inside NuiField it defaults to the field value.
invalid
boolean
—
Shows the error state without a text. With error it turns on by itself.
label
string
—
Label of the control. Inside NuiField the field provides the label.
description
string
—
Hint below the control. Screen readers announce it with the control.
error
string
—
Error text below the control. Puts the control into the error state.
reserveError
boolean
false
Reserves space for the error so the form does not shift when it appears.
modelModifiers
Partial<Record<NuiTextareaModifiers, true>>
—
v-model modifiers: lazy and trim.

Models

Name
Type
Default
Description
v-model
string
""
Field text.

Exposed

Name
Type
Description
focus
() => void | undefined
Focuses the field.

Edit this page

Search

Esc