Skip to main content

Autocomplete

Description

<jp-autocomplete> is a field component with a combination of <input> functionality and <select> functionality.


Attributes

NameRequiredTypeDescription
optionsstring[]list of autocomplete options
asyncOptions(string) => Promise<array>async function that takes value of input and returns new options
lagnumbertime it takes for asyncOptions to be called after input stops changing
labelstringshows at the top of an input
labelType'outside' or 'inside'whether label is inside or outside of the field
placeholderstringtemporary text that appears in an
input field before any input is entered
namestringname of the form control
idstringunique identifier
disabledbooleandetermines if an input is disabled
requiredbooleandetermines if an input is required
requiredValidationMessagestringvalidation message for when component does not satisfy required
minlengthnumberminimum character count allowed
minlengthValidationMessagestringvalidation message for when component does not satisfy minlength
maxlengthnumbermaximum character count allowed
maxlengthValidationMessagestringvalidation message for when component does not satisfy maxlength
patternstringpattern that input has to satisfy
patternValidationMessagestringvalidation message for when component does not satisfy pattern
validationMessages{[type]: string} where type is stringcompact way of writing validation messages in a single attribute


Slots

This component does not have any slots.



Methods

  • getValue
    • returns form field value
  • reportValidity
    • triggers reportValidity


Events

  • value
    • triggers when value of the field changes


Demo

Live Editor
// import '@jaspero/web-components/autocomplete.wc.js';
// import '@jaspero/web-components/autocomplete.css';

<jp-autocomplete options='["One", "Two", "Three"]' label="Autocomplete"></jp-autocomplete>
Result
Loading...