TextField

Form & Input
stable

Full-featured text input field with label, placeholder, counter, masking, validation, prepend/append icons and multiple visual variants.

API

Props

All props accepted by this component, with their type, default value and description.

autofocus
boolean
false
Focuses the input on mount.
counter
boolean | number | string
Displays a character counter. Pass a number to set the max.
counterValue
number | ((e: any) => number)
placeholder
string
Placeholder text shown when the field is empty.
persistentPlaceholder
boolean
persistentCounter
boolean
role
string
type
TTextFieldType
'text'
HTML input type. Drives the browser keyboard on mobile and enables native validation.
modelModifiers
string | boolean
mask
TMask
Input mask spec — a built-in preset key ('phone:fr'…), a raw pattern ('(##) ###-####') or a full options object. v-model exposes the unmasked value.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
color
TColor
Active/focus color of the field border and label.
density
TDensity
'default'
Adjusts the input padding density.
centerAffix
boolean
dirty
boolean
disabled
boolean
false
Disables the input — prevents focus and user interaction.
error
string | boolean
inline
boolean
label
string
Floating label shown above or inside the field.
prefix
string
suffix
string
persistentClear
boolean
singleLine
boolean
required
boolean
loading
TControlLoadingValue
false
Shows a loading indicator below the field.
tag
string
loadingText
string
bgColor
TColor
appendInnerAvatar
string
appendInnerIcon
TIcon
Icon rendered inside the field, after the input text.
prependInnerAvatar
string
prependInnerIcon
TIcon
Icon rendered inside the field, before the input text.
clearIcon
TIcon
clearable
boolean
false
Shows a clear icon when the field has a value.
prependInnerAriaLabel
string
appendInnerAriaLabel
string
border
boolean | number | string | TDirectionBoth | Array<TDirectionBoth>
borderTop
boolean | number | string
borderLeft
boolean | number | string
borderBottom
boolean | number | string
borderRight
boolean | number | string
borderBlock
boolean | number | string
borderInline
boolean | number | string
borderInlineStart
boolean | number | string
borderInlineEnd
boolean | number | string
borderBlockStart
boolean | number | string
borderBlockEnd
boolean | number | string
borderColor
string
borderStyle
string
borderTopColor
TColor
borderRightColor
TColor
borderBottomColor
TColor
borderLeftColor
TColor
borderInlineStartColor
TColor
borderInlineEndColor
TColor
borderBlockStartColor
TColor
borderBlockEndColor
TColor
focused
boolean
text
string
floating
boolean
name
string
margin
boolean | number | string
marginTop
boolean | number | string
marginLeft
boolean | number | string
marginBottom
boolean | number | string
marginRight
boolean | number | string
marginBlock
boolean | number | string
marginInline
boolean | number | string
marginInlineStart
boolean | number | string
marginInlineEnd
boolean | number | string
marginBlockStart
boolean | number | string
marginBlockEnd
boolean | number | string
padding
boolean | number | string
paddingTop
boolean | number | string
paddingLeft
boolean | number | string
paddingBottom
boolean | number | string
paddingRight
boolean | number | string
paddingBlock
boolean | number | string
paddingInline
boolean | number | string
paddingInlineStart
boolean | number | string
paddingInlineEnd
boolean | number | string
paddingBlockStart
boolean | number | string
paddingBlockEnd
boolean | number | string
rounded
boolean | number | string | TRounded | null | undefined
Border-radius token for the field wrapper.
roundedTopRight
boolean | number | string
roundedTopLeft
boolean | number | string
roundedBottomLeft
boolean | number | string
roundedBottomRight
boolean | number | string
roundedStartStart
boolean | number | string
roundedStartEnd
boolean | number | string
roundedEndStart
boolean | number | string
roundedEndEnd
boolean | number | string
fontSize
TFontSize
fontWeight
TFontWeight
lineHeight
TLineHeight
letterSpacing
TLetterSpacing
active
boolean | IStateEffectConfig
activeClass
string
variant
TVariantInput
'outlined'
Visual style of the field wrapper.
elevation
TElevation
size
TSize | number
hideDetails
boolean | string
false
Hides the hints/errors area. auto hides it when there is no content to show.
hideSpinButtons
boolean
hint
string
persistentHint
boolean
messages
Array<string> | string
height
number | string
maxHeight
number | string
maxWidth
number | string
minHeight
number | string
minWidth
number | string
width
number | string
direction
TDirection
errorMessages
Array<string> | string
Validation error messages rendered below the field.
maxErrors
number | string
readonly
boolean
false
Makes the input read-only — displays but does not allow editing.
rules
Array<any>
modelValue
any
Bound value of the text field. Bind with v-model.
validateOn
TValidateOn
validationValue
any
appendAvatar
string
appendIcon
TIcon
Icon rendered outside the field, after the input.
prependAvatar
string
prependIcon
TIcon
Icon rendered outside the field, before the input.
prependAriaLabel
string
appendAriaLabel
string

API

Slots

Content slots exposed by this component.

#counter
Custom character counter renderer.
#field
Replaces the entire inner field surface — advanced use only.
#default
Inner content of the field — rarely used directly.
#prepend-inner
Custom content inside the field, before the input.
#loader
#append-inner
Custom content inside the field, after the input.
#label
Custom label content, replaces the text label.
#floatingLabel
#prefix
#suffix
#prependInner
#appendInner
#clear
#details
#prepend
Custom content before the field (outside the border).
#append
Custom content after the field (outside the border).
#messages
#message

API

Emits

Events emitted by this component.

@click:control
MouseEvent
Fired when the user clicks the control surface (the field wrapper).
@mousedown:control
MouseEvent
Fired on mousedown on the control surface.
@valid
boolean
Emitted on every input/paste when a mask is active — carries the current validity status.
@complete
{ complete: boolean, unmasked: string }
Emitted when every slot of the mask has been filled.
@update:focused
any
@click:appendInner
MouseEvent
@click:prependInner
MouseEvent
@click:clear
MouseEvent
Fired when the clear icon is clicked.
@update:modelValue
any
Fired on every input change. When a mask is active, carries the unmasked value.
@click:append
MouseEvent
Fired when the user clicks the append icon area.
@click:prepend
MouseEvent
Fired when the user clicks the prepend icon area.

Interactive

Playground

Edit props live and see the component update in real time. The generated code snippet updates as you change values.

Rendering the live preview…

Usage

Examples

Ready-to-paste code snippets for your templates.

Basic text field

vue

Variants

vue

Input mask

vue