diff --git a/packages/paste-core/components/radio-group/src/RadioGroup.tsx b/packages/paste-core/components/radio-group/src/RadioGroup.tsx index 2fefbc0689..179727945a 100644 --- a/packages/paste-core/components/radio-group/src/RadioGroup.tsx +++ b/packages/paste-core/components/radio-group/src/RadioGroup.tsx @@ -8,41 +8,35 @@ export interface RadioGroupProps extends InlineControlGroupProps { onChange: (value: string) => void; } -const RadioGroup: React.FC = ({ - name, - value, - onChange, - disabled = false, - errorText, - children, - ...props -}) => { - const onChangeHandler = React.useMemo(() => { - return (event: React.ChangeEvent): void => { - if (onChange != null) { - onChange(event.target.value); - } - }; - }, [onChange]); +const RadioGroup = React.forwardRef( + ({name, value, onChange, disabled = false, errorText, children, ...props}, ref) => { + const onChangeHandler = React.useMemo(() => { + return (event: React.ChangeEvent): void => { + if (onChange != null) { + onChange(event.target.value); + } + }; + }, [onChange]); - const contextValue = React.useMemo(() => { - return { - name, - value: value || '', - disabled, - hasError: errorText != null, - onChange: onChangeHandler, - }; - }, [name, value, disabled, errorText, onChangeHandler]); + const contextValue = React.useMemo(() => { + return { + name, + value: value || '', + disabled, + hasError: errorText != null, + onChange: onChangeHandler, + }; + }, [name, value, disabled, errorText, onChangeHandler]); - return ( - - - {children} - - - ); -}; + return ( + + + {children} + + + ); + } +); RadioGroup.displayName = 'RadioGroup';