lucid-ui
Version:
A UI component library from AppNexus.
28 lines (27 loc) • 1.02 kB
JavaScript
import React from 'react';
import createClass from 'create-react-class';
import { SingleSelect } from '../../../index';
const { Placeholder, Option } = SingleSelect;
export default createClass({
getInitialState() {
return {
selectedIndex: null,
};
},
handleSelect(optionIndex) {
this.setState({
selectedIndex: optionIndex,
});
},
render() {
return (React.createElement("section", null,
React.createElement(SingleSelect, { isInvisible: true, isDisabled: true, onSelect: this.handleSelect },
React.createElement(Placeholder, null, "Select Color"),
React.createElement(Option, null, "Red"),
React.createElement(Option, null, "Green"),
React.createElement(Option, null, "Blue")),
React.createElement("section", { style: { marginTop: '10px' } },
"Selected Index: ",
JSON.stringify(this.state.selectedIndex))));
},
});