UNPKG

lucid-ui

Version:

A UI component library from AppNexus.

29 lines (28 loc) 1.01 kB
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, { 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", null, React.createElement("p", null, "Selected Index: ", JSON.stringify(this.state.selectedIndex))))); }, });