signavio / react-mentions

@mention people in a textarea
https://react-mentions.vercel.app
Other
2.47k stars 573 forks source link

Pre-open suggestion list #668

Open simon-tannai opened 1 year ago

simon-tannai commented 1 year ago

Hello 👋

I'm using async request to load data into suggestion list. This request take couple of seconds, so nothing happens while I have not the request response.

Is there a way to "pre-open" the suggestion container to display into it a loader before get the response request ?

soheilaGhayour commented 1 year ago

For displaying loading, you can do something like this.

<MentionsInput
                        customSuggestionsContainer={(children) => (loading ? <Spinner /> : <Paper elevation={3}>{children}</Paper>)}
                    >
                        <Mention
                            isLoading={loading}
                        />
</MentionsInput>