For every widget that inherit from WBP_GenericInputHandler, and its sub widgets (example, for a menu its sub widget is a button) you can contextually show or hide certain elements from screen base on the device that you are using (mouse, keyboard, gamepad).
To begin with make sure your menu inherit from the right class, follow this post to learn how to do it.
After that if you select any widget in your menu

in its Details Panel, in the Behavior section you’ll find the Visibility field, on the right side of the value you will bind a box called Bind

if you select one of the functions showed in the list, you are making sure that this widget will only be visible when that device is active, for example if you select GamepadVisibility, it will be visible only when you use your gamepad, you can even specity two devices, like mouse and keyboard.