Skip to content

Autocomplete ​

Loading...

Autocomplete: a text input with a dropdown of selectable suggestions.

  • Tag: <flint-autocomplete>
  • Class: FlintAutocomplete

Import ​

ts
import '@getufy/flint-ui'; // auto-registers all
// or
import { FlintAutocomplete } from '@getufy/flint-ui';

Usage ​

html
<flint-autocomplete></flint-autocomplete>

Properties ​

PropertyAttributeTypeDefaultDescription
optionsoptions(AutocompleteOption | string)[][]The list of selectable options. Accepts AutocompleteOption[] or string[].
freeSolofreeSolobooleanfalseWhen true, allows arbitrary values that are not in the options list.
disableddisabledbooleanfalseWhether the autocomplete input is disabled.
valuevaluestring''The current selected value.
placeholderplaceholderstring''Placeholder text shown when the input is empty.
namenamestring''Form field name used when submitting form data.
requiredrequiredbooleanfalseMarks the autocomplete as required for form validation.
defaultValuedefault-valuestring''Initial value for uncontrolled usage.
hoisthoistbooleantrueWhen true, the dropdown uses position: fixed so it can escape
popupDistancepopup-distancenumber4Distance between the input and the dropdown popup (px).

Events ​

EventDetailDescription
flint-autocomplete-change&#123; value: string, label: string &#125;Fired when the selected value changes. detail: &#123; value: string, label: string &#125;

CSS Parts ​

NameDescription
baseThe component's base wrapper element.
dropdownThe dropdown container.
inputThe native input element.
optionAn individual option element.

CSS Custom Properties ​

PropertyDefault
--flint-autocomplete-dropdown-max-height250px
--flint-autocomplete-z-index1000
--flint-autocomplete-option-padding10px 12px
--flint-font-family—
--flint-input-border-color—
--flint-input-border-radius—
--flint-text-color—
--flint-input-bg—
--flint-primary-color—
--flint-input-disabled-bg—
--flint-text-color-subtle—
--flint-surface-1—
--flint-shadow-md—
--flint-hover-color—
--flint-text-color-muted—