Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 1.46 KB

File metadata and controls

49 lines (33 loc) · 1.46 KB

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}
}>