InputField
A versatile text input component with support for various HTML5 types, error states, and a built-in password visibility toggle.
Install: pnpm add-component Fields/InputField
Basic inputs
Standard text and email inputs with labels and placeholders.
Password with toggle
Setting type to "password" automatically adds a visibility toggle icon.
Password strength
The meter says the level in words as well as colour, and each rule reads "Done" or "Not yet" with an icon. Scoring is a pure function, scorePassword(value, rules), exported from InputField: no zxcvbn. Until every rule holds, the level stops at Fair. In AppForm: { type: "password", strength: true }.
Custom password rules
Rules are { label, test } pairs. A passphrase policy might ask for length and words instead of symbols.
Number & date
Supports numeric values and native date-time pickers.
Validation states
Display helpful error messages to guide the user.
Readonly / disabled
Use the readonly prop for non-editable fields.
Immediate correcting validation
See how errors disappear instantly as you type valid data, powered by the useFormValidation composable.
API
modelValue(string | number): The value of the input (v-model).label(string): Label text displayed above the input.type('text' | 'password' | 'email' | 'number' | 'datetime-local'): The HTML input type.placeholder(string): Hint text displayed when the input is empty.error(string): Error message to display below the input. Triggers error styling.readonly(boolean): If true, the input is non-interactive and styled as disabled.customClass(string): Additional CSS classes for the input element.strength(boolean | { rules?: PasswordRule[] }): Password only: a strength meter (role="meter", the level in words) and the rules as a checklist linked to the input with aria-describedby. Pass rules to replace the default five. The level is announced once typing pauses.