nextui icon indicating copy to clipboard operation
nextui copied to clipboard

[Feature Request] Autocomplete render trailing custom element functionality

Open CelloAdrian opened this issue 1 year ago • 2 comments

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

CelloAdrian avatar May 01 '24 17:05 CelloAdrian

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!

ryo-manba avatar May 12 '24 13:05 ryo-manba