UNPKG

sc-react-ions

Version:

An open source set of React components that implement Ambassador's Design and UX patterns.

36 lines (29 loc) 764 B
import React from 'react' import Input from 'react-ions/lib/components/Input' import Button from 'react-ions/lib/components/Button' import style from './style.scss' class ExampleInputPopulated extends React.Component { constructor(props) { super(props) } state = { text: 'Test text' }; addPeriod = () => { this.setState({ text: this.state.text + '.' }) } handleChange = event => { this.setState({ text: event.target.value }) } render() { return ( <div> <div className={style.update}> <Button onClick={this.addPeriod}>Append a period</Button> </div> <Input value={this.state.text} changeCallback={this.handleChange} /> </div> ) } } export default ExampleInputPopulated