diff --git a/examples/src/app.js b/examples/src/app.js index bfda0ce816..628f34b60f 100644 --- a/examples/src/app.js +++ b/examples/src/app.js @@ -12,6 +12,7 @@ import Multiselect from './components/Multiselect'; import NumericSelect from './components/NumericSelect'; import Virtualized from './components/Virtualized'; import States from './components/States'; +import AllowCreate from './components/AllowCreate'; ReactDOM.render(
@@ -26,6 +27,7 @@ ReactDOM.render( {/* */} +
, document.getElementById('example') ); diff --git a/examples/src/components/AllowCreate.js b/examples/src/components/AllowCreate.js new file mode 100644 index 0000000000..73d729c619 --- /dev/null +++ b/examples/src/components/AllowCreate.js @@ -0,0 +1,64 @@ +import React from 'react'; +import Select from 'react-select'; + +const FLAVOURS = [ + { label: 'Chocolate', value: 42 }, + { label: 'Vanilla', value: 'vanilla' }, + { label: 'Strawberry', value: 'strawberry' }, + { label: 'Caramel', value: 'caramel' }, + { label: 'Cookies and Cream', value: 'cookiescream' }, + { label: 'Peppermint', value: 'peppermint' }, +]; + +var AllowCreate = React.createClass({ + displayName: 'AllowCreate', + + propTypes: { + allowCreate: React.PropTypes.bool, + label: React.PropTypes.string, + }, + + getInitialState () { + return { + disabled: false, + crazy: false, + options: FLAVOURS, + value: [], + }; + }, + + onLabelClick (data, event) { + console.log(data, event); + }, + + handleSelectChange (value){ + this.setState({ value }); + }, + + renderHint () { + return ( +
Create options in tag mode
+ ); + }, + + render () { + return ( +
+

{this.props.label}

+