{"id":19853005,"url":"https://github.com/ship-components/ship-components-tag-input","last_synced_at":"2026-04-13T00:12:56.729Z","repository":{"id":53755517,"uuid":"88194252","full_name":"ship-components/ship-components-tag-input","owner":"ship-components","description":"A multi-featured select component allowing single select, multi-select, and typeahead functionality. ","archived":false,"fork":false,"pushed_at":"2021-03-15T23:19:21.000Z","size":1683,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":5,"default_branch":"develop","last_synced_at":"2024-04-25T13:22:12.940Z","etag":null,"topics":["babel","javascript-library","jsx","loader","multi-select","react","tags","webpack"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/ship-components-tag-input","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":"2017-04-13T18:23:15.000Z","updated_at":"2021-03-15T22:39:58.000Z","dependencies_parsed_at":"2022-09-02T15:01:35.139Z","dependency_job_id":null,"html_url":"https://github.com/ship-components/ship-components-tag-input","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ship-components%2Fship-components-tag-input","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ship-components%2Fship-components-tag-input/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ship-components%2Fship-components-tag-input/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ship-components%2Fship-components-tag-input/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ship-components","download_url":"https://codeload.github.com/ship-components/ship-components-tag-input/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241241890,"owners_count":19932836,"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-library","jsx","loader","multi-select","react","tags","webpack"],"created_at":"2024-11-12T14:05:10.609Z","updated_at":"2026-04-13T00:12:56.675Z","avatar_url":"https://github.com/ship-components.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ship-components-tag-input\n\n[JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript) Material Design React Multi-Select Box. Exports a commonjs module that can be used with [webpack](http://webpack.github.io/). Source is in ES6 and an ES5 version is available using [Babel](https://babeljs.io/).\n\n[![npm](https://img.shields.io/npm/v/ship-components-tag-input.svg?maxAge=2592000)](https://www.npmjs.com/package/ship-components-tag-input)\n[![Build Status](http://img.shields.io/travis/ship-components/ship-components-tag-input/master.svg?style=flat)](https://travis-ci.org/ship-components/ship-components-tag-input)\n[![Coverage](http://img.shields.io/coveralls/ship-components/ship-components-tag-input.svg?style=flat)](https://coveralls.io/github/ship-components/ship-components-tag-input)\n[![devDependencies](https://img.shields.io/david/dev/ship-components/ship-components-tag-input.svg?style=flat)](https://david-dm.org/ship-components/ship-components-tag-input?type=dev)\n\n## Docs \u0026 Help\n\n* [Docs](#docs)\n* [Usage](#usage)\n* [Development](#development)\n* [Webpack Configuration](#webpack-configuration)\n* [Tests](#tests)\n* [History](#history)\n\nHere is the list of options you can use.\n\n* [Filterable](#filterable)\n* [DarkTheme](#darkTheme)\n* [OrderOptionsBy](#orderOptionsBy)\n* [Placeholder](#placeholder)\n* [TogglePosition](#togglePosition)\n* [NoOptionsMessage](#noOptionsMessage)\n* [ToggleSwitchStyle](#toggleSwitchStyle)\n\n## Docs\n#### filterable\n{bool}\nTrue by default. Enables an option to let user search inside the text input for a match.\n\n#### darkTheme\n{bool}\nFalse by default.\n\n#### orderOptionsBy\n{string}\n'titles' by default. User can pass a prop to order the dropdown result list based on that prop. For instance if your option object looks like:\n```js\noptions = {\n  id: 1,\n  title: 'Option 1'\n}\n\u003c!-- User can pass 'id' to order by id or 'title' to order by titles  --\u003e\n```\n\n#### togglePosition\n{string}\n'left' by default.\n\n#### noOptionsMessage\n{string}\nempty by default.\n\n#### toggleSwitchStyle\n{string}\n'search' by default. Please refer to [ship-components-icon](https://github.com/ship-components/ship-components-icon) for the list of icons you can pass in.\n\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\n/**\n * ES6 TagInput Example\n */\nimport React from 'react';\nimport Immutable from 'immutable';\nimport TagInput from 'ship-components-tag-input';\n\nexport default class ExampleClass extends React.Component {\n  constructor(props) {\n    super(props);\n    this.state = {\n      value: new Immutable.List()\n\n    };\n    this.handleChange = this.handleChange.bind(this);\n  }\n\n  handleChange(tag) {\n    this.setState({\n      value: tag\n    });\n  }\n\n  render() {\n    const options = [\n      {\n        id: 3,\n        title: 'Option 1',\n        searchString: 'Option 1'\n      },\n      {\n        id: 2,\n        title: 'Option 2',\n        searchString: 'Option 2'\n      },\n      {\n        id: 1,\n        title: 'Option 3',\n        searchString: 'Option 3'\n      }\n    ];\n\n    return (\n      \u003cdiv className='form-group'\u003e\n        \u003cTagInput\n          filterable                                     // True by default\n          darkTheme                                     // False by default\n\n          orderOptionsBy='id'                           // 'titles' by default\n          placeholder='Choose Tag Inputs'               // 'Select...' by default\n          togglePosition='right'                        // 'left' by default\n          noOptionsMessage='There are no more tags...'  // '' by default\n          toggleSwitchStyle='library_add'               // 'search' by default\n\n          value={this.state.value}\n          onChange={this.handleChange}                  // REQUIRED\n        /\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n\nReactDOM.render(\u003cExamples /\u003e, document.getElementById('examples'));\n```\n\n## Development\nMore examples can be found in the `examples/` folder. A development server can be run with:\n\n```shell\n$ git clone https://github.com/ship-components/ship-components-tag-input.git\n$ npm install\n$ npm test\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. Below are is a sample of how to setup the loaders in webpack 3:\n\n```js\n/**\n * Relevant Webpack Configuration\n */\n{\n  [...]\n  module: {\n    rules: [\n      {\n        test: /\\.(jsx?|es6)$/,\n        enforce: 'pre',\n        exclude: /(node_modules|dist)/,\n        include: /src\\/.*/,\n        use: 'eslint-loader'\n      },\n      // ES6/JSX for App\n      {\n        test: /\\.(jsx?|es6)$/,\n        exclude: [\n          /node_modules/\n        ],\n        use: 'babel-loader'\n      },\n      {\n        test: /\\.(jsx?|es6)$/,\n        include: [\n          /ship-components-.*\\/src/\n        ],\n        use: 'babel-loader'\n      },\n      {\n        test: /\\.(png|woff|woff2|eot|ttf|svg)(\\?v=[0-9]\\.[0-9]\\.[0-9])?$/,\n        use: [\n          {\n            loader: 'file-loader',\n            options: {\n              name: '[path][name].[ext]'\n            }\n          }\n        ]\n      },\n      // CSS Modules\n      {\n        test: /\\.css$/,\n        use: ExtractTextPlugin.extract({\n          fallback: 'style-loader',\n          use: [\n            {\n              loader: 'css-loader',\n              options: {\n                modules: true,\n                importLoaders: 1,\n                localIdentName: '[name]--[local]'\n              }\n            },\n            {\n              // CSS Modules\n              loader: 'postcss-loader',\n              options: {\n                plugins: () =\u003e [\n                  require('postcss-nested')(),\n                  require('postcss-simple-vars')({\n                    /**\n                     * Default variables. Should be overridden in mail build system\n                     * @type {Object}\n                     */\n                    variables: {\n                      'primary-color': '#38b889',\n                      'opacity-disabled': '0.58',\n                      'base-grid-size': '4px'\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      }\n    ]\n  },\n\n  plugins: [\n    new webpack.LoaderOptionsPlugin({\n      options: {\n        context: __dirname,\n        eslint: {\n          // Strict linting enforcing\n          failOnWarning: true\n        }\n      }\n    }),\n    new ExtractTextPlugin({\n      filename: '[name].css',\n      disable: false,\n      allChunks: true\n    })\n  ],\n  [...]\n}\n```\n\n## Tests\n* `npm run test`: to run the tests\n* `npm run test:update`: to run the tests and update the snapshots\n* `npm run test:watchAll`: to run the tests and watch all tests\n\n1. `npm install`\n2. `npm test`\n\n## History\n\n* 1.1.0 -  Adds a selectItemBy prop in order to be able to deselect items based on what the props passes in\n* 1.0.13 - Updated ship-components-utility to newer version\n* 1.0.11 - Removed invalid css comment, removed unneeded \"engines\", applied audit fixes\n* 1.0.9 - Fixes the behavior for multiple=false\n* 1.0.8 - Disable filtering when results are fetched from server\n* 1.0.7 - Fixes search results with short filterText\n* 1.0.6 - Fixes the behavior of the enter key\n* 1.0.5 - Prevent tabbing to the toggle switch\n* 1.0.4 - Fixes the behavior of the tab key\n* 1.0.3 - Fixes the label overlapping the entered filter text on blur.\n* 1.0.2 - Fixes the broken input layout due to the `invert` feature\n* 1.0.0 - Upgrade to React 16\n* 0.7.0 - Feature: prop `invert` to change the component display order\n* 0.6.3 - Bugfix: Fixed bug when pressing enter without an option highlighted.\n* 0.6.2 - Bugfix: Fixed label position for when selected tags span multiple lines.\n* 0.6.1 - Bugfix: Fixed disappearing label when input has value.\n* 0.6.0 - Feature: prop function `fetchOptions` for custom ajax on filter input. CSS fix: dropdown requires no extra styling to look like examples.\n* 0.5.3 - CSS fix: dropdown can be wider than text input.\n* 0.5.0 - Adds unit tests.\n* 0.4.3 - Fixes the bug where updating the options in parent component don't change in TagInput component(componentWillReceiveProps).\n* 0.4.1 - Fixes bug where Dropdown is not positioned dynamically based on input height.\n* 0.4.0 - Adds an option to let use pass in the value as a prop. The state of tags is now handled inside the parent.\n* 0.3.0 - Adds a functionality to fetch options from a URL instead of passing options as a prop (Internal use only).\n* 0.2.1 - Aligns the component with the rest of ship-components in terms of UI and the functionality.\n* 0.1.0 - Initial\n\n## License\nThe MIT License (MIT)\n\nCopyright (c) 2017 SHIP\n\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-tag-input","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fship-components%2Fship-components-tag-input","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fship-components%2Fship-components-tag-input/lists"}