Skip to content

BaseAutocompleteInput

View source on GitHub

A customizable autocomplete input component with optional dropdown, validation, and theming. *

Props

NameTypeRequiredDescription
labelstringnoThe label for the input field.
modelValuestring & numbernoThe model value bound to the input field.
idstringnoThe id for the input field.
disabledbooleannoFlag to indicate if the input is disabled.
placeholderstringnoThe placeholder text for the input field.
classTypestringnoThe class type for conditional styling.
colorstringnoThe color context for styling (e.g., "plant", "distillation").
invalidInputbooleannoFlag to indicate if the input is invalid.
resultsany[]noList of results for the dropdown/autocomplete.
toChoosebooleannoIf true, enables dropdown selection mode.

Emits

  • update:modelValue
  • choose:item
  • update:onBlur
  • open:list

Exposed Methods

updateValue()

Updates the model value when input changes.

Parameters:

  • e (Event): The input event.

chooseItem()

Updates the model value after clicking a list item. Temporarily disables blur to prevent unintended triggers.

Parameters:

  • result (any): The selected result/item.

handleBlur()

Handles the blur event for the input field. Emits the onBlur event if blur is not disabled.

openList()

Opens or closes the dropdown list.