Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we add a filterable prop to AutoComplete #6349

Open
3 tasks done
liuchao92 opened this issue Sep 12, 2024 · 0 comments
Open
3 tasks done

Can we add a filterable prop to AutoComplete #6349

liuchao92 opened this issue Sep 12, 2024 · 0 comments
Labels
feature request New feature or request

Comments

@liuchao92
Copy link

Clear and concise description of the problem

e.g. User can type any text in a company input, and he can choose a existed company name from a company list.

So the company list need to be filtered when user inputed some text:

image

For now, I need to do something like this:

code snippet in template:

<n-form-item label="Company" path="company">
  <n-auto-complete
    v-model:value="data.company"
    :options="companyAutoCompleteOptions"
    placeholder="Company name"
    :get-show="() => true"
  />
</n-form-item>

code snippet in script:

const companyAutoCompleteOptions = computed(() => {
  const companies = [
    'TestA',
    'TestB',
    'TestC',
    'TestD',
    'TestE',
    'CompanyC'
  ]
  return companies.filter(c => c.includes(data.value.company)).map((suffix) => {
    return {
      label: suffix,
      value: suffix
    }
  })
})

Maybe we can add a filterable prop make it more easy to use.

Suggested solution

Add a filterable prop to AutoComplete, just like filterable in Select.

Alternative

No response

Additional context

AutoComplete component in other UI library:

Validations

  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
@liuchao92 liuchao92 added the feature request New feature or request label Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant