Skip to content
On this page

Autocomplete

The Autocomplete component is used to select an option from a list of options. Additionally, it provides a search input to filter the options.

Usage

Selected Value:
null
vue
<template>
  <Autocomplete
    :options="[
      { label: 'Apple', value: 'apple' },
      { label: 'Banana', value: 'banana' },
      { label: 'Orange', value: 'orange' },
    ]"
    v-model="fruit"
    placeholder="Select a fruit"
  />
</template>

<script>
import { ref } from 'vue'
import { Autocomplete } from 'frappe-ui'
let fruit = ref(null)
</script>

Props

NameDefaultValueDescription
modelValuenullObjectNo need to directly pass this prop. Just use v-model.
valuenullObjectThis prop should be used if you are not using v-model. Value must be one of the options object from options or null. This object must be a direct reference and not a copy.
optionsnullArrayArray of objects with label and value keys
placeholdernullStringString to show as placeholder when no value is set

Events

NameDescription
update:modelValueThis event is emitted when value is changed or unset and v-model is used.
changeThis event is emitted when value is changed or unset and value prop is used.