JSPM

  • Created
  • Published
  • Downloads 4973742
  • Score
    100M100P100Q190356F
  • License MIT

A Select control built with and for React

Package Exports

  • react-select

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-select) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

React-Select

A Select control built with and for React, initially being developed for use in KeystoneJS.

Project Status

This is currently a work in progress.

It's loosely based on Selectize (in terms of behaviour and user expereience) and React-Autocomplete (as a native React Combobox implemenation), as well as other select controls including Chosen and Select2.

TODO:

  • CSS Styles and theme support
  • Multiselect
  • Remote options loading
  • Custom options rendering
  • Cleanup of focus state management

Installation

You currently need to install this component via NPM and include it in your own React build process (using Browserify, etc).

Standalone builds will be available in the future.

npm install react-select --save

Usage

React-Select generates a hidden text field containing the selected value, so you can submit it as part of a standard form.

Options should be provided as an Array of Objects, each with a value and label property for rendering and searching.

var Select = require('react-select');

var options = [
    { value: 'one', label: 'One' },
    { value: 'two', label: 'Two' }
];

<Select 
    name="form-field-name"
    value="one"
    options={options}
}>