Skip to content

Commit f58b4e6

Browse files
committed
fix(forms): allow jsx elements on form label
1 parent f956414 commit f58b4e6

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/forms/FormGroup.jsx

+8
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ FormGroup.defaultProps = {
2828
FormGroup.propTypes = {
2929
children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
3030
feedback: PropTypes.bool,
31+
label: PropTypes.node.isRequired,
3132
mockInvalidSibling: PropTypes.bool,
3233
name: PropTypes.string.isRequired,
3334
};
@@ -44,6 +45,7 @@ FormGroupAutocomplete.propTypes = {
4445
disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
4546
filter: PropTypes.func,
4647
id: PropTypes.string,
48+
label: PropTypes.node.isRequired,
4749
name: PropTypes.string.isRequired,
4850
onSearch: PropTypes.func,
4951
openOnFocus: PropTypes.bool,
@@ -69,6 +71,7 @@ FormGroupCheckbox.propTypes = {
6971
disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
7072
falseLabel: PropTypes.node,
7173
id: PropTypes.string.isRequired,
74+
label: PropTypes.node.isRequired,
7275
name: PropTypes.string.isRequired,
7376
required: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
7477
trueLabel: PropTypes.node,
@@ -85,6 +88,7 @@ export function FormGroupInput(props) {
8588
FormGroupInput.propTypes = {
8689
disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
8790
id: PropTypes.string,
91+
label: PropTypes.node.isRequired,
8892
max: PropTypes.string,
8993
maxLength: PropTypes.string,
9094
min: PropTypes.string,
@@ -124,6 +128,7 @@ FormGroupRadio.propTypes = {
124128
disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
125129
id: PropTypes.string,
126130
inline: PropTypes.bool,
131+
label: PropTypes.node.isRequired,
127132
name: PropTypes.string.isRequired,
128133
options: PropTypes.arrayOf(
129134
PropTypes.shape({
@@ -145,6 +150,7 @@ export function FormGroupSelect(props) {
145150
FormGroupSelect.propTypes = {
146151
disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
147152
id: PropTypes.string,
153+
label: PropTypes.node.isRequired,
148154
name: PropTypes.string.isRequired,
149155
options: PropTypes.oneOfType([
150156
PropTypes.func,
@@ -176,6 +182,7 @@ FormGroupSwitch.propTypes = {
176182
disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
177183
falseLabel: PropTypes.node,
178184
id: PropTypes.string.isRequired,
185+
label: PropTypes.node.isRequired,
179186
name: PropTypes.string.isRequired,
180187
required: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
181188
trueLabel: PropTypes.node,
@@ -192,6 +199,7 @@ export function FormGroupTextarea(props) {
192199
FormGroupTextarea.propTypes = {
193200
disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
194201
id: PropTypes.string,
202+
label: PropTypes.node.isRequired,
195203
name: PropTypes.string.isRequired,
196204
placeholder: PropTypes.string,
197205
readOnly: PropTypes.bool,

src/forms/FormLabel.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ export function FormLabel({ id, label, required: _required }) {
1616

1717
FormLabel.propTypes = {
1818
id: PropTypes.string,
19-
label: PropTypes.string,
19+
label: PropTypes.node.isRequired,
2020
required: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
2121
};

0 commit comments

Comments
 (0)