0

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.

Purbasha
  • 215
  • 2
  • 11

2 Answers2

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...

0

selectedKey={undefined}

As the type supports

IChoiceGroupProps.selectedKey?: string | number | undefined