Input
VInput is a single-line field with optional label, help text, icons and actions.
Usage
Examples
Label and hint
label names the field. hint adds help text linked through aria-describedby.
Sizes
size adjusts the height, padding, text and icons.
Icons
Add decorative icons with iconStart and iconEnd, or custom content with #start and #end.
Clear button
clearable adds a button that empties the field and restores focus. Use clearVisible to control its visibility.
States
disabled blocks interaction. readonly allows focus and copying. invalid marks an error, and error also shows its message in place of the hint. loading shows a spinner while leaving the field editable.
Clickable icons
Attach @click:icon-start or @click:icon-end to make an icon a button. Provide its accessible name with iconStartLabel or iconEndLabel.
Character counter
counter displays the character count. With maxlength, softLimit allows typing past the limit and reports a native validation error.
Native validation
Native attributes such as pattern, inputmode and name are forwarded to the input. class and style apply to the wrapper.
API
Props
| Prop | Type | Default |
|---|---|---|
size | InputSize'sm' | 'md' | 'lg' | 'md' |
Field size. Overridden when VInputGroup sets size. | ||
type | InputType'text' | 'email' | 'number' | 'password' | 'search' | 'tel' | 'url' | 'text' |
| Native input type. | ||
invalid | boolean | false |
Sets aria-invalid and the error style. Does not block form submission by itself. | ||
disabled | boolean | false |
| Disables the field, removing it from Tab navigation and form submission. | ||
readonly | boolean | false |
Prevents editing while allowing focus and copying. Hides the clear button unless clearVisible overrides it. | ||
noTyping | boolean | false |
Prevents typing through native readonly without the read-only style. Keeps clearing available, for fields edited through a picker. | ||
label | string | none |
Visible label linked to the input. When omitted, provide aria-label or aria-labelledby. | ||
hint | string | none |
Help text below the field, linked through aria-describedby. | ||
error | string | none |
Error message shown in place of the hint. Sets aria-invalid, is linked through aria-describedby and is announced when it appears. | ||
required | boolean | false |
Adds an asterisk after the label and passes required to the field. | ||
hideLabel | boolean | false |
| Hides the label visually while keeping it as the accessible name. | ||
labelPosition | FieldLabelPosition'top' | 'start' | 'top' |
| Places the label above the field or beside it. | ||
iconStart | IconSource | none |
Start icon. Becomes a button with @click:icon-start; then requires iconStartLabel. | ||
iconEnd | IconSource | none |
End icon. Becomes a button with @click:icon-end; then requires iconEndLabel. Replaced by #end or the loading spinner. | ||
iconStartLabel | string | none |
| Accessible name of the start icon button. | ||
iconEndLabel | string | none |
| Accessible name of the end icon button. | ||
loading | boolean | false |
Replaces the end icon or #end content with a spinner. Does not disable the field. | ||
loadingText | string | none |
| Accessible spinner text. Defaults to the library dictionary. | ||
clearable | boolean | false |
Adds a clear button when the field is non-empty and editable, unless clearVisible overrides visibility. Hidden when disabled. | ||
clearVisible | boolean | none |
Overrides the content and read-only checks for clear-button visibility. Requires clearable and an enabled field. | ||
clearLabel | string | none |
| Accessible name of the clear button. Defaults to the library dictionary. | ||
maxlength | number | none |
Native character limit. Not applied as a native attribute with softLimit. | ||
softLimit | boolean | false |
Allows exceeding maxlength and sets a native validation error until the value is within the limit. | ||
counter | boolean | false |
Character count inside the field: 12/80 with a limit, or 12 without one. | ||
v-model | string | number | '' |
Field value, a string or number. With type="number", Vue converts numeric input to a number. An empty field uses an empty string. | ||
Events
| Event | Type |
|---|---|
click:icon-start | [event: MouseEvent] |
Emitted when the start icon button is activated. Receives a MouseEvent. | |
click:icon-end | [event: MouseEvent] |
Emitted when the end icon button is activated. Receives a MouseEvent. | |
clear | [] |
| Emitted after the clear button resets the value to an empty string. | |
Slots
| Slot | Type |
|---|---|
start | {} |
Content after iconStart. Does not replace the icon. | |
value-end | {} |
| Content after the value and counter, before the clear button and end icon. | |
control | { controlProps: InputControlProps; } |
Control replacing the input, for composed fields. Bind the received controlProps on it: id, field class, ARIA links and forwarded attributes. | |
end | {} |
Content replacing iconEnd. Hidden while loading. | |
meta | { id: string; } |
Content at the end of the hint line, such as a counter. Bind its id, which joins the field description. | |
Types
Types used in the API tables. Import exported types from vectis-ui.
export interface BuiltinIcon {
name: string
paths: readonly [string] | readonly [string, string]
}export type IconRender =
| { path: string; viewBox?: string }
| { component: Component; props?: Record<string, unknown> }
| { src: string }
| { text: string; class?: string }
| { class: string }export type IconSource = string | BuiltinIcon | IconRender
export type InputControlProps = {
id: string
class: string
disabled: boolean
'aria-invalid'?: 'true'
'aria-describedby'?: string
} & Record<string, unknown>