react-select-dropdown
Advanced tools
Comparing version 1.0.7 to 1.0.8
{ | ||
"name": "react-select-dropdown", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "A Dropdown for react", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -1,3 +0,48 @@ | ||
React Simple Dropdown | ||
React Select Dropdown | ||
[Demo](http://bhargav175.github.io/react-select-dropdown/dist/index.html#/) | ||
## 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 | ||
@@ -84,3 +84,3 @@ var React = require('react'); | ||
{displayText}<div className='dropdown-container'> | ||
<ul ref='dropdown_menu' className={self.state.open ? 'dropdown-menu open' + self.props.name : 'dropdown-menu close' + self.props.names}> | ||
<ul ref='dropdown_menu' className={self.state.open ? 'dropdown-menu open ' + self.props.name : 'dropdown-menu close' + self.props.names}> | ||
{dropdownItems} | ||
@@ -87,0 +87,0 @@ </ul> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1148211
49