Form | TextInput
TextInput#
Description#
- Reusable text field with
v-modelsupport, native types (text,password,search,url,email,number,date,time,datetime-local), visual error indication, monospace mode for aligned values and declared keyboard events.
Props#
modelValue(string) — Field value. Required.type('text' | 'password' | 'search' | 'url' | 'email' | 'number' | 'date' | 'time' | 'datetime-local') — Field type. Default:'text'.size('md' | 'lg') — Field height:mdis 32 px,lgis 40 px. Default:'md'.bare(boolean) — No border or background, for surfaces that already frame it. Default:false.id(string) — Field identifier, needed to associate it withFormGroup.ariaLabel(string) — Accessible name when there is no visible label.describedBy(string) — Theidof the error or help text below the field.autocomplete(string) — What to autocomplete.spellcheck(boolean) — Controls the browser spell check. Default:undefined.autocapitalize('none' | 'off' | 'sentences' | 'words' | 'characters') — Automatic capitalization on virtual keyboard. Default:undefined.placeholder(string) — Placeholder text.disabled(boolean) — Disables the field. Default:false.readonly(boolean) — Makes the field read-only. Default:false.invalid(boolean) — Draws the error border for an invalid value. Default:false.mono(boolean) — Applies monospace font for paths and commands. Default:false.required(boolean) — Marks the field as required. Default:false.lazy(boolean) — Emitsupdate:modelValueon blur instead of on every keystroke. Default:false.
Emits#
update:modelValue(string) — Emitted when the value changes. Withlazy, on blur; otherwise, on every keystroke.keyup(KeyboardEvent) — Forwards thekeyupevent from theinput.keydown(KeyboardEvent) — Forwards thekeydownevent from theinput.
Usage#
| |
Notes#
- The
focus()method focuses the field and returns a boolean indicating success.enfocarexists as a deprecated alias (removed in 3.0). - No built-in label: use
FormGroup, which associates it with the field viaid. - The
keyupandkeydownevents must be forwarded manually in the template, since Vue removes all declared events from attributes.