{"id":19852994,"url":"https://github.com/ship-components/ship-components-typeahead","last_synced_at":"2026-04-05T21:04:45.814Z","repository":{"id":57163523,"uuid":"46875721","full_name":"ship-components/ship-components-typeahead","owner":"ship-components","description":"Material Design React Typeahead Component","archived":false,"fork":false,"pushed_at":"2019-03-13T00:01:42.000Z","size":505,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-06-14T00:39:47.524Z","etag":null,"topics":["babel","javascript","jsx","loader","material-design","react","typeahead","webpack"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/ship-components-typeahead","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ship-components.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-25T17:10:43.000Z","updated_at":"2019-03-13T00:01:44.000Z","dependencies_parsed_at":"2022-08-31T22:23:04.346Z","dependency_job_id":null,"html_url":"https://github.com/ship-components/ship-components-typeahead","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ship-components/ship-components-typeahead","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ship-components%2Fship-components-typeahead","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ship-components%2Fship-components-typeahead/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ship-components%2Fship-components-typeahead/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ship-components%2Fship-components-typeahead/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ship-components","download_url":"https://codeload.github.com/ship-components/ship-components-typeahead/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ship-components%2Fship-components-typeahead/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262477044,"owners_count":23317406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["babel","javascript","jsx","loader","material-design","react","typeahead","webpack"],"created_at":"2024-11-12T14:05:08.274Z","updated_at":"2025-12-30T22:22:24.924Z","avatar_url":"https://github.com/ship-components.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-typeahead\n[React](http://facebook.github.io/react/) component to allow fuzzy searching of a list for a value as you type. Exports a commonjs module that can be used with [webpack](http://webpack.github.io/). Source is in ES6 and is compiled down to ES5 using [Babel](https://babeljs.io/).\n\n[![npm](https://img.shields.io/npm/v/ship-components-typeahead.svg?maxAge=2592000)](https://www.npmjs.com/package/ship-components-typeahead)\n[![Build Status](http://img.shields.io/travis/ship-components/ship-components-dialog/master.svg?style=flat)](https://travis-ci.org/ship-components/ship-components-typeahead)\n[![Coverage](http://img.shields.io/coveralls/ship-components/ship-components-dialog.svg?style=flat)](https://coveralls.io/github/ship-components/ship-components-typeahead)\n[![dependencies](https://img.shields.io/david/ship-components/ship-components-typeahead.svg?style=flat)](https://david-dm.org/ship-components/ship-components-typeahead)\n[![devDependencies](https://img.shields.io/david/dev/ship-components/ship-components-typeahead.svg?style=flat)](https://david-dm.org/ship-components/ship-components-typeahead?type=dev)\n\n## Usage\n\n### ES6/JSX (Recommended)\nThe component is written using ES6/JSX therefore Babel is recommended to use it. The below example is based on using [webpack](http://webpack.github.io/) and [babel-loader](https://github.com/babel/babel-loader).\n```js\nimport React from 'react';\nimport Typeahead from 'ship-components-typeahead';\n\nexport default class BasicExample extends React.Component\n\n  render() {\n    return (\n      \u003cTypeahead\n        options={[\n          {\n            value: 'One'\n          },\n          {\n            value: 'Two'\n          },\n          {\n            value: 'Three'\n          }\n        ]}\n        extract={(item)=\u003eitem.label}\n        value={this.state.value}\n        onChange={this.handleChange} /\u003e\n    );\n  }\n}\n```\n\n## Examples and Development\n[![Typeahead-Demo.gif](https://s7.postimg.org/4z5nhx7qz/Typeahead_Demo.gif)](https://postimg.org/image/vwzkjnsdz/)\n\nMore examples can be found in the `examples/` folder. A development server can be run with:\n\n```shell\n$ npm install\n$ npm start\n```\n\nwhich will live reload any changes you make and serve them at http://localhost:8080.\n\n### Webpack Configuration\nThis module is designed to be used with webpack but requires a few loaders if you are pulling the source into another project.\n\n```shell\n$ npm install webpack babel-loader css-loader style-loader postcss-loader extract-text-webpack-plugin postcss-nested postcss-color-hex-alpha postcss-color-function postcss-calc postcss-simple-vars autoprefixer --save-dev\n```\n\nBelow are is a sample of how to setup the loaders:\n\n```js\n/**\n * Relevant Webpack Configuration\n */\n{\n  [...]\n  module: {\n    loaders: [\n      // Setup support for ES6\n      {\n        test: /\\.(jsx?|es6)$/,\n        exclude: /node_modules/,\n        loader: 'babel'\n      },\n      // Setup support for CSS Modules\n      {\n        test: /\\.css$/,\n        loader: ExtractTextPlugin.extract('style-loader', 'css-loader?modules\u0026importLoaders=1\u0026localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader')\n      }\n    ]\n  },\n  plugins: [\n    // Extract the css and put it in one file. Path is relative to output path\n    new ExtractTextPlugin('../css/[name].css', { allChunks: true })\n  ],\n  // CSS Modules\n  postcss: [\n    require('postcss-nested'),\n    require('postcss-simple-vars') {\n      variables: {\n        'base-grid-size' : '4px',\n        'primary-color' : '#5e8aaa',\n        'accent-color' : '#38b889',\n        'warning-color' : '#d43c36',\n        'success-color' : '#50a111',\n        'primary-font-color': '#333',\n        'inverse-font-color': '#fff',\n        'primary-background-color' : '#fff'\n      }\n    },\n    require('postcss-color-hex-alpha'),\n    require('postcss-color-function'),\n    require('postcss-calc'),\n    require('autoprefixer')\n  ],\n  [...]\n}\n```\n\n## Todo\n* Add an option to create menu using children\n\n## Tests\n1. `npm install`\n2. `npm test`\n\n## History\n* 2.0.2 - Fixed a bug with rendering currently selected option\n* 2.0.1 - Render currently selected option\n* 2.0.0 - Upgrade to React 16\n* 1.0.1 - Update to use postcss-calc 6\n* 1.0.0 - Update to use prop-types (for React 16 compatibility)\n* 0.5.3 - Fixes the UI bug where long option items are cut off.\n* 0.5.2 - Updates to the latest babel configurations (babel-preset-env).\n* 0.5.1 - Bugfix for sometimes-null dropdown dom. Bugfix for Enter key return null value on to change handler.\n* 0.5.0 - Add support for 'hangover' dropdowns when Typeahead is inside an overflow:hidden container. Added support for error message in ship-components-textinput 0.2.0.\n* 0.4.0 - Upgrades component to be consistent with React 15 version.\n* 0.3.2 - Fixed a bug where tab was selecting when it shouldn't be\n* 0.3.1 - Fixed issue with blur being called before it should be\n* 0.3.0 - Ignore keydown on special keys ('Alt', 'CapsLock', 'Control', 'Fn', 'Meta', 'Shift', 'Tab'). Tab still selects menu items.\n* 0.2.0 - Removed props.defaultValue, updated to React 15\n* 0.1.0 - Initial\n\n## License\nThe MIT License (MIT)\n\nCopyright (c) 2016 SHIP\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fship-components%2Fship-components-typeahead","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fship-components%2Fship-components-typeahead","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fship-components%2Fship-components-typeahead/lists"}