nextui-org / nextui

🚀 Beautiful, fast and modern React UI library.
https://nextui.org
MIT License
21.57k stars 1.41k forks source link

[Feature Request] Autocomplete render trailing custom element functionality #2925

Open CelloAdrian opened 5 months ago

CelloAdrian commented 5 months ago

Is your feature request related to a problem? Please describe.

When dynamically populating autocomplete from an array, we don't have an option to render a custom element to the Autocomplete component, in this case for example a "Create New" button

Describe the solution you'd like

It would be nice to be able to render a custom element in the Autocomplete component when we specify the prop

Describe alternatives you've considered

Material UI has this functionality : https://mui.com/material-ui/react-autocomplete/#FreeSoloCreateOption.js

Screenshots or Videos

image image

linear[bot] commented 5 months ago

ENG-774 [Feature Request] Autocomplete create item functionality

ryo-manba commented 4 months ago

Thanks for the issue! As a workaround, you could potentially add a custom item like Add "{inputValue}" when the list of filtered items becomes empty using the onInputChange event. Additionally, you could remove any prefix from the message in the onSelectionChange event based on the key. If you try this out, please let us know how it goes!