react-mentions icon indicating copy to clipboard operation
react-mentions copied to clipboard

Manually Open Suggestions

Open brunoalano opened this issue 5 years ago • 3 comments

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.

brunoalano avatar Jan 14 '20 15:01 brunoalano

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

michnowak2003 avatar Apr 13 '20 11:04 michnowak2003

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>
</>)

PJijin avatar May 22 '20 15:05 PJijin