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)
<script src="path/to/react-chosen.js"></script>
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.
- Bonus little wrapper for
selectNode.trigger("liszt:updated")
->chosenComponent.update();
. - This README is longer than the source code, go check it out.
Example
<script type="text/jsx">
/**
* @jsx React.DOM
*/
React.renderComponent(
<Chosen noResultText="No result" onChange={doSomething}>
<option value="Facebook">Facebook</option>
<option value="Harvest">Harvest</option>
</Chosen>
, document.body);
</script>
License
MIT.