Skip to content

Commit

Permalink
fix: ui.radio value defaulting
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshatJawne committed Sep 11, 2024
1 parent e31ac51 commit 540c8cd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions plugins/ui/src/js/src/elements/Radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,22 @@ export function Radio({
onBlur: serializedOnBlur,
onKeyDown: serializedOnKeyDown,
onKeyUp: serializedOnKeyUp,
value: valueProp,
children,
...props
}: SerializedRadioProps): JSX.Element {
const onFocus = useFocusEventCallback(serializedOnFocus);
const onBlur = useFocusEventCallback(serializedOnBlur);
const onKeyDown = useKeyboardEventCallback(serializedOnKeyDown);
const onKeyUp = useKeyboardEventCallback(serializedOnKeyUp);

const value = valueProp ?? (typeof children === 'string' ? children : '');

return (
<DHRadio
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
value={value as string}
onFocus={onFocus}
onBlur={onBlur}
onKeyDown={onKeyDown}
Expand Down

0 comments on commit 540c8cd

Please sign in to comment.