diff --git a/src/ButtonInput.js b/src/ButtonInput.js new file mode 100644 index 0000000000..846d577ed4 --- /dev/null +++ b/src/ButtonInput.js @@ -0,0 +1,40 @@ +import React from 'react'; +import Button from './Button'; +import FormGroup from './FormGroup'; +import InputBase from './InputBase'; + +function valueValidation({children, value}, propName, componentName) { + if (children && value) { + return new Error('Both value and children cannot be passed to ButtonInput'); + } + return React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.number]).call(null, {children, value}, propName, componentName); +} + +class ButtonInput extends InputBase { + renderFormGroup(children) { + let {bsStyle, value, ...other} = this.props; /* eslint no-unused-vars: 0 object-shorthand: 0 */ + return {children}; + } + + renderInput() { + let {children, value, ...other} = this.props; + let val = children ? children : value; + return