Skip to content

TextInput

Single-line free-form text entry. Reach for it whenever the user is typing a string or a number — names, identifiers, search queries, free-form notes, numeric values without a slider or unit picker.

Supports prefix/suffix text, leading/trailing icons, and all validation states (default, error, warning, success, missing, disabled, read-only).

Basic

html
<TextInput v-model="value" placeholder="Type something" />

With prefix and suffix

Use prefix/suffix for short string adornments — currency symbols, units, etc.

$
kg
html
<TextInput v-model="amount" prefix="$" placeholder="0.00" />
<TextInput v-model="weight" suffix="kg" placeholder="0" />

With icons

Use leadingIcon/trailingIcon for iconic adornments — search, validation, etc.

html
<TextInput v-model="query" leading-icon="magnifying-glass" placeholder="Search…" />
<TextInput v-model="value" trailing-icon="calendar" placeholder="Pick a date" />

Validation states

Aurora's form fields share a single set of state flags. Pass exactly one of error, success, warning, or missing at a time.

html
<TextInput v-model="email" error placeholder="Email" />
<TextInput v-model="email" success placeholder="Email" />
<TextInput v-model="email" warning placeholder="Email" />
<TextInput v-model="email" missing placeholder="Email" />

Disabled and readonly

html
<TextInput v-model="value" disabled placeholder="Disabled" />
<TextInput model-value="Read only value" readonly />

Props

PropTypeDefaultDescription
modelValuestring | numberTwo-way bound value. Use with v-model.
defaultValuestring | numberInitial value when uncontrolled.
namestringForm field name.
placeholderstringPlaceholder text shown when empty.
prefixstringShort text adornment shown before the input.
suffixstringShort text adornment shown after the input.
leadingIconIconNameIcon shown before the input.
trailingIconIconNameIcon shown after the input.
autofocusbooleanfalseFocus the input on mount.
errorbooleanfalseApply error state styling.
successbooleanfalseApply success state styling.
warningbooleanfalseApply warning state styling.
missingbooleanfalseApply missing-required-field state styling.
disabledbooleanfalseDisable interactions.
readonlybooleanfalseRender as read-only (no border, no editing).

State flags (error, success, warning, missing, disabled, readonly) are mutually exclusive — passing more than one yields the first that matches. Use FormField (TODO: link when migrated) when you also want labels and validation messages around the input.

Exposed methods

TextInput exposes a focus() method via defineExpose — call inputRef.value?.focus() from a parent.

html
<TextInput ref="inputRef" />