Warm tip: This article is reproduced from stackoverflow.com, please click
reactjs react-bootstrap-typeahead

Select matched option with React Bootstrap Typeahead

发布于 2020-03-27 10:22:07

In my React Bootstrap Typeahead component, the user can press Tab to select the currently matched option. How can I accept Enter as well?

Questioner
David Harkness
Viewed
189
ericgio 2019-07-04 01:28

You can use the selectHintOnEnter prop to achieve this behavior:

<Typeahead
  options={[ ... ]}
  selectHintOnEnter
/>

Enabling this prop will allow users to select the hint by pressing Enter as well as Tab. Here's a live example.