react-mentions
react-mentions copied to clipboard
Manually Open Suggestions
Expected behaviour:
An API on MentionsInput
which would allow me to manually open the Suggestions, where I could trigger based on a Button for example.
<Button onClick={() => mentionsInputRef.showSuggestions()} />
Observed behaviour: Not implemented (from what I see).
Workaround: No related issue found, except by the #237, but was not answered.
I have the same problem in my project! I want to open sugesstions list when user type any character. I don't want to implement other autocomplete function because i'm using react-mentions too
I have similar issue and here is how I have solved it.
const [message, setMessage] = useState('');
const inputRef = useRef();
return (
<>
<MentionsInput
inputRef={inputRef}
value={message}
>...</MentionsInput>
<a onClick={ () => {
setMessage(message + ' @');
inputRef?.current?.focus();
}}>
Mention
</a>
</>)