Input API

This page provides an overview of the Input component API, detailing its props, emits, slots, and exposed methods/states.

Props

The Input component accepts the following props:

PropDefaultTypeDescription
type"text""text" or "number" or "email" or "password"The type of input field.
autoFocusfalsebooleanAutomatically focuses the input field on mount.
placeholder""stringPlaceholder text for the input field.
autocomplete"on""on" or "off"Autocomplete behavior for the input field.
maskInput"""phone" or "number" or "price" or stringMask type for the input value.
lengthIntegernullnumberMaximum length for the integer part of the input value.
lengthDecimalnullnumberMaximum length for the decimal part of the input value.
classInput""StyleClassCustom CSS class for the input element.
idundefinedstringUnique identifier for the input element.
modelValueundefinedstring or number or null or undefinedThe current value of the input field.

Emits

The Input component emits the following events:

EmitPayloadDescription
clearstringEmitted when the input is cleared.
focusFocusEventEmitted when the input gains focus.
blurFocusEventEmitted when the input loses focus.
update:modelValuestringEmitted when the modelValue is updated.
change:modelValuestringEmitted when the modelValue changes.
update:isInvalidbooleanEmitted when the invalid state of the input is updated.
isActivebooleanEmitted when the input becomes active.

Slots

The Input component provides the following slots:

SlotPayloadDescription
defaultVNode[]Default slot for custom content inside the input component.
beforeVNode[]Slot for content to be displayed before the input field.
afterVNode[]Slot for content to be displayed after the input field.

Expose

The Input component exposes the following methods and states via ref:

ExposeValueDescription
layoutInputLayoutExpose or undefinedReference to the input layout state.
isActiveInputbooleanIndicates whether the input is active.
classLayoutInputProps["class"]Custom CSS class for the input layout.
idInputProps["id"]Current id of the input field.
typeInputProps["type"]Current type of the input field.
maskInputProps["maskInput"]Current mask type applied to the input field.
modelValueInputProps["modelValue"]Current value of the input field.
autoFocusInputProps["autoFocus"]Indicates whether autofocus is enabled.
placeholderInputProps["placeholder"]Current placeholder text of the input field.
autocompleteInputProps["autocomplete"]Current autocomplete setting of the input field.
lengthIntegerInputProps["lengthInteger"]Maximum length for the integer part of the input value.
lengthDecimalInputProps["lengthDecimal"]Maximum length for the decimal part of the input value.
isValueInputLayoutProps["isValue"]Indicates whether the input has a value.
modeInputProps["mode"]Current mode of the input.
isDisabledInputProps["disabled"]Indicates whether the input is disabled.
isLoadingInputProps["loading"]Indicates whether the input is in a loading state.
isInvalidInputProps["isInvalid"]Indicates whether the input is invalid.
messageInvalidInputProps["messageInvalid"]Validation error message for the input field.
classBaseInputInputProps["class"]CSS class for the input base container.

Methods:

  • toMask(baseValue: string | number): string - Applies a mask to the input value.
  • inputModelValue(valueResult: any): void - Updates the input's model value.
  • changeModelValue(valueResult: any): void - Changes the input's model value and triggers the associated event.
  • clear(): void - Clears the input's value.
  • focus(eventFocus: FocusEvent): void - Focuses the input field.
  • blur(eventFocus: FocusEvent): void - Blurs the input field.
© 2025 FishtVue by Egoka