Skip to content

Commit 19ce196

Browse files
committed
fix(pf4): Allow to customize radio options
1 parent c1f0c77 commit 19ce196

File tree

1 file changed

+10
-9
lines changed
  • packages/pf4-component-mapper/src/files

1 file changed

+10
-9
lines changed

packages/pf4-component-mapper/src/files/radio.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,20 @@ import { useFieldApi } from '@data-driven-forms/react-form-renderer';
44
import { Radio as Pf4Radio } from '@patternfly/react-core';
55
import FormGroup from '../common/form-group';
66

7-
const RadioOption = ({ name, option, isDisabled, isReadOnly }) => {
8-
const { input } = useFieldApi({ name, value: option.value });
7+
const RadioOption = ({ name, option: { value, label, ...restOption }, isDisabled, isReadOnly }) => {
8+
const { input } = useFieldApi({ name, value });
99
return (
1010
<Pf4Radio
11-
key={`${name}-${option.value}`}
11+
key={`${name}-${value}`}
1212
{...input}
13-
isChecked={input.value === option.value}
14-
value={option.value}
15-
onChange={() => input.onChange(option.value)}
16-
label={option.label}
17-
id={`${name}-${option.value}`}
18-
aria-label={option.label}
13+
isChecked={input.value === value}
14+
value={value}
15+
onChange={() => input.onChange(value)}
16+
label={label}
17+
id={`${name}-${value}`}
18+
aria-label={label}
1919
isDisabled={isDisabled || isReadOnly}
20+
{...restOption}
2021
/>
2122
);
2223
};

0 commit comments

Comments
 (0)