React-based typeahead component that uses Bootstrap as a base for styles and behaviors and supports both single- and multi-selection. The UI and behaviors are inspired by Twitter's typeahead.js. Try a live example.
Please note that this library is under active development and the APIs may change. The documentation below applies to the most recent version and may no longer be applicable if you're using an outdated version.
Use NPM to install the module in your project:
$ npm install --save react-bootstrap-typeahead
Include the module in your project as you normally would:
// Using ES2015 modules
import Typeahead from 'react-bootstrap-typeahead';
// Using CommonJS (Note: you must add `.default`)
var Typeahead = require('react-bootstrap-typeahead').default;
Minified and unminified UMD modules are also included in the NPM package, or you can get them from CDNJS.
A pre-release of v1.0 is now available. The code is reasonably stable, but could use some additional real-world testing. New examples and better documentation are currently the main things gating a full release. The latest stable version is v0.10.4.
This version has some breaking changes. Please see the release notes for more information. In particular, there is no longer a default Typeahead
component:
// v1.0
import {Typeahead} from 'react-bootstrap-typeahead'; // ES2015
var Typeahead = require('react-bootstrap-typeahead').Typeahead; // CommonJS
The component tries to use as little CSS as possible, relying primarily on Bootstrap or any Bootstrap themes for styling. Some minimal styling is included in Typeahead.css
and Token.css
and should ideally be included wherever you're using the component.
To modify the example, clone the repository, npm install
and npm run example
to build the example index file. You can then open the HTML file locally in a browser. You can also try the live example.
Recent versions of the following browsers are supported:
- Chrome
- Firefox
- IE (10/11)
- Safari