primevue icon indicating copy to clipboard operation
primevue copied to clipboard

`empty` slot for Autocomplete

Open telion2 opened this issue 2 years ago • 2 comments

I'm submitting a ...

[ ] bug report => Search github for a similar issue or PR before submitting
[x] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primevue/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=110

I want a slot that is shown when no suggestion matches the user Input. This slot should not be selectable or focusable but should otherwise behave similarly to the items (teleporting to the same position, using the same size etc.). So something like this:

 <template #noSuggestion="{}">
          //Custom Code
</template>

Motivation: If the user clicks on the autocomplete or inputs a string that does not match any suggestion, then there should be a message that informs the user that he has to change his input in order to see suggestions. Otherwise, the user can be potentially confused, as to why the autocomplete does "not work" as expected. Currently, I don't see a proper way to do that. I managed to do a workaround using optiongroups, but it's still a workaround.

  • Vue version: 3.X
  • PrimeVue version: 3.11.X

telion2 avatar May 06 '22 09:05 telion2

@telion2 i also need this slot, could you show me what was your workaround?

asbyago avatar May 25 '22 18:05 asbyago

The option headers are not clickable. Meaning if you use v-if you can hide the suggestion part and show your message in a header instead. You need to artificially add a suggestion though

telion2 avatar May 31 '22 16:05 telion2

@tugcekucukoglu Do you have a working code example of this ? I'm not able to see the empty slot https://codesandbox.io/embed/primevue-autocomplete-empty-9fch4q?fontsize=14&hidenavigation=1&theme=dark

j-meds avatar Mar 04 '23 00:03 j-meds