Hide and Disable mouse and keyboard input when using gamepad and vice versa?

I am using a default UUserWidget and I want to make the feature Hide and Disable mouse and keyboard input when using gamepad and vice versa. Anyone have any solutions? Thank you in advance.