Skip to content

Commit cfa98f5

Browse files
committed
Generator: add id to checkbox
1 parent ea36b35 commit cfa98f5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

templates/component-mapper/src/files/checkbox.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,24 @@ const SingleCheckbox = (props) => {
2121
return (
2222
<React.Fragment>
2323
<label htmlFor={name}>{label}</label>
24-
<input {...input} type="checkbox" disabled={isDisabled}/>
24+
<input {...input} id={name} type="checkbox" disabled={isDisabled}/>
2525
</React.Fragment>
2626
);
2727
};
2828

29-
const SingleCheckboxInCommon = ({ label, isDisabled, ...props }) => (
29+
const SingleCheckboxInCommon = ({ label, isDisabled, id, ...props }) => (
3030
<React.Fragment>
31-
<label htmlFor={props.name}>{label}</label>
32-
<input {...props} type="checkbox" disabled={isDisabled} />
31+
<label htmlFor={id}>{label}</label>
32+
<input {...props} id={id} type="checkbox" disabled={isDisabled} />
3333
</React.Fragment>
3434
);
3535

3636
SingleCheckboxInCommon.propTypes = {
3737
label: PropTypes.node,
3838
input: PropTypes.object,
3939
isDisabled: PropTypes.bool,
40-
name: PropTypes.string
40+
name: PropTypes.string,
41+
id: PropTypes.string
4142
};
4243

4344
const Checkbox = ({ options, ...props }) =>

0 commit comments

Comments
 (0)