React-chosen
React wrapper for Chosen jQuery.
install
bower install react-chosen
Or simply drop the script somewhere on your page (after React and Chosen of course):
The npm build works, but unfortunately not well:
npm install react-chosen
Due to the awkwardness of Chosen and jQuery on npm, you'll still have to include jQuery as a global dependency. Installing via npm is not recommended.
API
Please refer to Chosen's API. It's pretty much the same, except:
-
Every Chosen option employs camelCase, e.g. disable_search_threshold -> disableSearchThreshold.
-
Just like React's controlled component,
value
controls your select and makes it immune to changes unless you specify so.
Example
/** @jsx React.DOM */React.renderComponent( Facebook Harvest , document.body); // or multi-selectReact.renderComponent( Apple Facebook Harvest , document.body);
License
MIT.