JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q39126F
  • License MIT

A Dropdown for react

Package Exports

  • react-select-dropdown

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-dropdown) 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 Dropdown

Demo

Installation

npm install react-select-dropdown

Can be used with browserify and React.

Definition

var SelectDropdown = require('react-select-dropdown');

Usage

var ReactSelectDropdownApp = React.createClass({
getInitialState: function(){
        return {
            items: [{name: 'Item One'}, {name: 'Item Two'}, {name: 'Item Three'}, {name: 'Item Four'}],selected: 1
            };
},
onItemSelected: function(item){
        console.log('You just selected ' + item.name);
        this.setState({selected: this.state.items.indexOf(item));
    },
render: function() {
    var self = this, selected = this.state.selected;
    //name serves as namespace for events
    //display_field is the property in an item which will be used to display

return (
    <div>
    <h1>Dropdown</h1>
    <SelectDropdown onItemSelected={self.onItemSelected} items={this.state.items} name='simpleDropdown' display_field='name' selected={selected}/>
</div>

);
}
});

module.exports = ReactSelectDropdownApp;

Styles