https://github.com/cbuschka/react-editable-select
A select component which can switch to text input to allow adding new elements.
https://github.com/cbuschka/react-editable-select
Last synced: about 2 months ago
JSON representation
A select component which can switch to text input to allow adding new elements.
- Host: GitHub
- URL: https://github.com/cbuschka/react-editable-select
- Owner: cbuschka
- License: mit
- Created: 2018-09-29T18:57:29.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-29T20:26:36.000Z (about 7 years ago)
- Last Synced: 2025-07-02T06:04:05.057Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 86.9 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README
# react-editable-select
### A select component that can be switched to text input to allow adding new elements.
## Prerequesites
* reactstrap
* bootstrap
* font-awesome
* yarn
* webpack
* es6## Try it out
* Activate nodejs
```
nvm use
```* Install yarn
```
npm -g install yarn
```* Start webpack dev server
```
yarn start
```* Goto http://localhost:3001/
## How to use
```
import {EditableSelect} from 'react-editable-select';...
option.id}
getOptionLabel={(option) => option.name}
createOption={(text) => { return {id: 1, name: text} }}
onChange={(ev, option) => ...}
/>
```| Property | Description |
| --- | --- |
| options | Array of options |
| value | Currently selected option |
| getOptionValue | Callback to convert option into option key |
| getOptionLabel | Callback to convert option into option label |
| createOption | Callback to create a new option |
| onChange | Callback invoked when option is selected or text field changes |## License
[MIT](./license.txt)