Skip to content

Commit c629c88

Browse files
committed
Add innerClassName prop to Form.Field
1 parent 43a78e6 commit c629c88

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

packages/react-components/source/react/library/form/FormField.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ const propTypes = {
4343
onChange: PropTypes.func,
4444
/** Optional additional className */
4545
className: PropTypes.string,
46+
/** Optional additional className for inner field */
47+
innerClassName: PropTypes.string,
4648
/** Optional additional inline styles */
4749
style: PropTypes.shape({}),
4850
/** All additional props are propagated to the inner input elements. See each option for details. TODO: figure out how to get this set up in styleguidist */
@@ -62,6 +64,7 @@ const defaultProps = {
6264
inlineLabelWidth: null,
6365
onChange() {},
6466
className: '',
67+
innerClassName: '',
6568
style: {},
6669
};
6770

@@ -108,23 +111,24 @@ const getFieldStyle = (style, inlineLabelWidth, tabbed) => {
108111

109112
const FormField = props => {
110113
const {
111-
type,
112-
name,
113-
label,
114-
labelType,
115114
className,
115+
description,
116+
error,
117+
innerClassName,
116118
inline,
117119
inlineLabelWidth,
118-
error,
119-
description,
120+
label,
121+
labelType,
122+
name,
120123
style,
124+
type,
121125
} = props;
122126
const typeName = getTypeName(type);
123127
const tabbed = inline && (type === 'checkbox' || type === 'switch');
124128
const labelStyle = getLabelStyle(inlineLabelWidth, inline);
125129
const fieldStyle = getFieldStyle(style, inlineLabelWidth, tabbed);
126130

127-
const element = <FormFieldElement {...props} />;
131+
const element = <FormFieldElement {...props} className={innerClassName} />;
128132

129133
if (type === 'hidden') {
130134
return element;

packages/react-components/source/react/library/form/internal/FormFieldElement.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ const FormFieldElement = props => {
5151

5252
const elementProps = omit(
5353
[
54+
'description',
5455
'inline',
5556
'inlineLabelWidth',
57+
'innerClassName',
5658
'labelType',
57-
'description',
58-
'className',
5959
'style',
6060
'requiredFieldMessage',
6161
'validateOnLoad',

0 commit comments

Comments
 (0)