From 5581ae4d891eefc38ec7e7b7960849c288808859 Mon Sep 17 00:00:00 2001 From: Akshat Jawne <69530774+AkshatJawne@users.noreply.github.com> Date: Sat, 21 Sep 2024 03:39:11 -0400 Subject: [PATCH] fix: ui.radio value defaulting (#818) Closes #765 --- plugins/ui/src/js/src/elements/Radio.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/ui/src/js/src/elements/Radio.tsx b/plugins/ui/src/js/src/elements/Radio.tsx index 5fc41f855..3bf497817 100644 --- a/plugins/ui/src/js/src/elements/Radio.tsx +++ b/plugins/ui/src/js/src/elements/Radio.tsx @@ -18,6 +18,8 @@ export function Radio({ onBlur: serializedOnBlur, onKeyDown: serializedOnKeyDown, onKeyUp: serializedOnKeyUp, + value: valueProp, + children, ...props }: SerializedRadioProps): JSX.Element { const onFocus = useFocusEventCallback(serializedOnFocus); @@ -25,15 +27,20 @@ export function Radio({ const onKeyDown = useKeyboardEventCallback(serializedOnKeyDown); const onKeyUp = useKeyboardEventCallback(serializedOnKeyUp); + const value = valueProp ?? (typeof children === 'string' ? children : ''); + return ( + > + {children} + ); }