Replies: 2 comments 1 reply
-
Yep, sure that would be a great addition and not that hard to implement, you'll need to add some more logic for TypeScript:
type AutocompleteItem = string | {
value: string;
[key: string]: any;
}
|
Beta Was this translation helpful? Give feedback.
0 replies
-
As I continue thinking about it – this can be also done for select so if you will work on that please also add this feature |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This might also be applicable for
Select
, but makes perfect sense for Autocomplete.Would it be possible to allow the
data
prop to accept an array of strings or the array of objects?Having an array of objects which are simply:
[{ value: "xxx" }]
could be short-circuited with just['xxx']
I've already run into this a couple times where I've forgotten I need to use the object. The component doesn't handle the incorrectly formatted prop very well.
https://codesandbox.io/s/mantine-autocomplete-fbete
I'm happy to try a PR with a helper function which converts the prop from an array of strings to the formatted object array - I just don't know if that has an impact to the typescript config.
Beta Was this translation helpful? Give feedback.
All reactions