I am using a choice group in y page and I have a situation where I need to clear radio button selection (if any). I am using selectedKey property n IChoiceGroup. On load, when I pass correct key id, it does select the right radio button, however, when I pass "undefined" to the selectedKey property, hoping to uncheck all selection, it doesnt do anything. The choice control still shows the previous selection.
Asked
Active
Viewed 1,451 times
0
-
Hi, provide Codepen working example or code inside question. Thanks. – Marko Savic Aug 14 '21 at 07:37
2 Answers
0
Did you try setting "selectedKey" to null?
<ChoiceGroup selectedKey={null} options={options} onChange={_onChange} />
As in this codepen: https://codepen.io/pkatny/pen/JjypJaX
Works for me...

Piotr Kątny
- 71
- 1
0
selectedKey={undefined}
As the type supports
IChoiceGroupProps.selectedKey?: string | number | undefined