We use a lot of Switches, but they can not have the value null. There is always something selected. So you can not really have it as a mandatory field. Because mandatory means, nothing is selected and you need to decide.
So you have to use an Radio Group as a Pill Button. But the layout differs from the switch and looks odd in comparison.
They both should have the same UI and a switch need to have the option to be unselected.
All you have to do is remove the class: “radio_group” and add the class: “apex-button-group” and it looks the same. Shouldn't be that hard to align that ;-)
Above is Switch, below is Pill Radio Group:
