Skip to main content

RadioGroup

Wrap a group of Radio Buttons to automatically control their selection
(code example)

Usage​

Live Editor
function Example(props) {
  const [currentValue, setCurrentValue] = useState('yes');
  return (
    <div>
      <RadioGroup initialValue={currentValue} onValueChange={setCurrentValue}>
        <RadioButton value={'yes'} label={'Yes'}/>
        <RadioButton marginT-10 value={'no'} label={'No'}/>
      </RadioGroup>
    </div>
  );
}
Result
Loading...

API​

initialValue​

The initial value of the selected radio button string | number | boolean

onValueChange​

Invoked once when value changes, by selecting one of the radio buttons in the group ((value?: string) => void) | ((value?: number) => void) | ((value?: boolean) => void) | ((value?: any) => void)