Search code examples
reactjsreact-bootstrap-typeahead

Select matched option with React Bootstrap Typeahead


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


Solution

  • 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.