- {label ?
: null}
-
+ {label ?
: null}
+ {component}
{hasError ?
{error}
: null}
);
@@ -55,12 +82,14 @@ InputField.defaultProps = {
inputRootClassName: null,
errorRootClassName: null,
clearOnUnmount: false,
+ inputComponent: null,
+ type: null,
label: null,
placeholder: null,
autoFocus: false,
};
-const { string, shape, bool, func } = PropTypes;
+const { string, shape, bool, func, oneOfType } = PropTypes;
InputField.propTypes = {
// Allow passing in classes to subcomponents
@@ -72,8 +101,13 @@ InputField.propTypes = {
clearOnUnmount: bool,
+ // If the type props is 'custom', this prop is used as the component
+ inputComponent: oneOfType([func, string]),
+
+ // 'custom', 'textarea', or something passed to an