I am currently working on implementing a feature with multi-select buttons using a custom component. My goal is to require that at least one option is selected at all times. This means that users can select multiple options, but the last remaining option cannot be deselected without showing an error message indicating that at least one selection is required.
For example, if multiple options are selected, there should be no error displayed:
https://i.sstatic.net/vQ3YV.png
However, if there is only one option selected and the user tries to deselect it, an error message should be shown like this:
https://i.sstatic.net/UjTJB.png
In such cases, a message should appear below stating,
"Atleast one should be selected.."
https://codesandbox.io/s/pedantic-haze-7f214
This sandbox link showcases my current progress towards achieving this functionality. I am also utilizing ReduxForm and building a custom field component with custom validation.