sterling-svelte  2.0.7
A modern, accessible, lightweight UI component library for Svelte.

Autocomplete

An Input providing a popover list of suggestions as the user types.

Code
<script lang="ts">
  import { Input } from '@geoffcox/sterling-svelte';
</script>

<Input bind:value />

Members

Property NameTypeDefaultComment
valuesstring[] | undefined[]The list of value sugestions to display.
itemSnippet<[string]> | undefinedundefinedThe item template to use for each value suggestion.
filter(values: string[], text: string) => string[] | undefinedundefinedThe filter function to override which values are displayed as the user types. The default filter is a case-insensitive substring match.

Considerations

  • HTMLInputElement props are forwarded to the Input component.
  • Includes HTMLInputElement props, events, and methods.

Anatomy

<div class="sterling-autocomplete">
  <Input />
  <Popover>
    <div class="sterling-autocomplete-content">
      <List class="composed">
        <!-- <ListItem> ... -->
      </List>
    </div>
  </Popover>
</div>