A normal radio group allows you to select one unique value exclusive to a group. This component allows you to select a unique value across multiple groups that share the same group of values. When an option is selected in one group, it is automatically disabled in associated groups.
$ npm i --save rc-shared-radio-groups
import SharedRadioGroups from 'rc-shared-radio-groups';
const sharedRadioGroupsHandler = (selection) => {
console.log(selection.name);
console.log(selection.value);
}
<SharedRadioGroups
names={['cat', 'dog']}
onSelect={sharedRadioGroupsHandler}
values={['first', 'second']}>
The component accepts three props.
Type: string[]
Required. Must be an array of strings.
Type: function
Optional. If passed must be a function. This is passed the name/value of a specific group when it is selected/deselected.
Type: array
These are the shared options available to select for each item in names
.