Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi Josh, this is great, exactly what I was looking for! I have a follow-up question - in case of a larger textarea, I would like the auto-complete to show somewhere below or above the current cursor position (not under the input box) - any tips on how to achieve this? Thanks
suggestion list scrolling is not happening with keyboard up and down arrow keys. please update code. Thanks
Good Day,
Just wanted confirm with your code the following:
onKeyDown = e => {
const { activeSuggestion, filteredSuggestions } = this.state;
if (e.keyCode === 13) {
this.setState({
activeSuggestion: 0,
showSuggestions: false,
userInput: filteredSuggestions[activeSuggestion]
});
} else if (e.keyCode === 38) {
if (activeSuggestion === 0) {
return;
}
this.setState({ activeSuggestion: activeSuggestion - 1 });
}
// User pressed the down arrow, increment the index
else if (e.keyCode === 40) {
if (activeSuggestion - 1 === filteredSuggestions.length) {
return;
}
this.setState({ activeSuggestion: activeSuggestion + 1 });
}
};
Shouldn’t the logic at the keyCode === 40 be activeSuggestion + 1 === filteredSuggestions.length as you increase your position when pressing the down arrow.
Please let me know if I am correct.