Interact button changes widget

Example:
In sea of thieves when you go near the barrel it shows up: “button image” open barrel

How to do that when the player set the button he prefers it changes the letter/button image in the widget?