Skip to content

Input ​

A single-line text field.

The receipt and the tracking number go here

The label, the hint and the error work as described on the Field page.

Installation ​

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

Usage ​

Change the type, the size and the states of the field.

Input type: text, email, password, search, tel or url.

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 ​

Add an icon or a unit ​

Put text or an icon into the prefix and suffix slots.

in

The slot content stays out of the model.

Enter a phone number with a mask ​

Describe the format in mask.

Ten digits after the country code

Mask characterAccepts
#A digit
AA letter
*A letter or a digit

The field adds the other mask characters, such as brackets and dashes, as the user types. Add .unmasked to v-model to keep only the typed characters in the model.

The mask and the model wait while an input method composes a word, such as CJK input or Android keyboard suggestions. They update when the composition ends, like v-model on a plain <input>.

Update the model after typing ​

Add the .lazy modifier.

The order has no city yet

The value reaches the model when the user leaves the field or presses Enter. Add .trim to drop the spaces at both ends.

Accessibility ​

A screen reader reads the label, the hint and the error together with the field. Attributes such as autocomplete and inputmode go to the <input> itself, and class and style go to the frame around it.

API ​

Props

Name
Type
Default
Description
type
NuiInputType
"text"
Input type: text, email, password, search, tel or url.
mask
string
—
Input mask, such as +1 (###) ###-####. # is a digit, A a letter, * a letter or digit.
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<NuiInputModifiers, true>>
—
The v-model modifiers: lazy, trim and unmasked.

Models

Name
Type
Default
Description
v-model
string
""
Field text. With a mask, the string with separators. With .unmasked, only the typed characters.

Slots

Name
Slot props
Description
prefix
{}
Content inside the field before the text, such as an icon.
suffix
{}
Content inside the field after the text, such as a button.

Exposed

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

Edit this page

Search

Esc