-
Notifications
You must be signed in to change notification settings - Fork 549
Conversation
3 similar comments
[spacing], | ||
); | ||
// suggestions | ||
useEffect( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give a simple example about how to use it?
And the auotComplete can support only autocomplete the last word? For example I have a sentence: "May the force be with you", and I input "May the fo", the suggestion should be "May the force".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AutoComplete component behaves like a combo box. So you need to provide the whole sentence "May the force".
Since the value and suggestionItems are controlled by its parent, you can add your own suggestion logic.
e.g. add "May the force" option only when user has input "May the f"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want a multiline word/phrase level AutoComplete component, I recommend you use Monaco Editor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks for the explanation.
What's this?
The difference between AutoComplete and ComboBox is that it is mainly focused on text input.
Props
items
value
are displayed by default.value
onChange
showAllSuggestions
Example