This Gist was automatically created by Carbide, a free online programming environment.
Created
December 7, 2016 16:12
-
-
Save brumm/87c6e3c3e4482b6ce2974267a7b0cd0f to your computer and use it in GitHub Desktop.
untitled
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MultiToggle = require('react-multi-toggle') | |
const groupOptions = [ | |
{ | |
displayName: 'Couple', | |
value: 2 | |
}, | |
{ | |
displayName: 'Family', | |
value: 4 | |
}, | |
]; | |
class Example extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
groupSize: 2 | |
}; | |
} | |
onGroupSizeSelect = value => this.setState({ groupSize: value }); | |
render = () => { | |
const { groupSize } = this.state; | |
return ( | |
<MultiToggle | |
options={groupOptions} | |
selectedOption={groupSize} | |
onSelectOption={this.onGroupSizeSelect} | |
label="Select Group Size" | |
/> | |
); | |
} | |
} | |
<Example /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment